I am looking for a reliable standard method to sort an array, returning the sorted ( associative ) array, as return value.
All the
Would you be able to do this?
$some_mixed_array = array( 998, 6, 430 );
function custom_sort( $array )
{
// Sort it
asort($array);
// return sorted array
return $array;
}
custom_sort( $some_mixed_array );
// returning: array( 6, 430, 998 )
This would also solve your issue:
$some_mixed_array = array( 998, 6, 430 );
echo ''.print_r($some_mixed_array, true).'
';
asort($some_mixed_array); // <- BAM!
// returning: array( 6, 430, 998 )
echo ''.print_r($some_mixed_array, true).'
';