Could you do that?
$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 will also solve your problem:
$some_mixed_array = array( 998, 6, 430 ); echo '<pre>'.print_r($some_mixed_array, true).'</pre>'; asort($some_mixed_array); // <- BAM! // returning: array( 6, 430, 998 ) echo '<pre>'.print_r($some_mixed_array, true).'</pre>';
source share