数据分析师2017-10-01 00:38:47
How does php sort the numbers in the array? - PHP Chinese website Q&A - How does php sort the numbers in the array? - PHP Chinese website Q&A
Take a look around and learn.
迷茫2017-03-04 14:11:36
可以使用自定义函数排序uasort(),搭配匿名函数挺方便的
$array = array('a' => 4, 'b' => 8, 'c' => -1, 'd' => -9, 'e' => 2, 'f' => 5, 'g' => 3, 'h' => -4); uasort($array,function($a,$b){ if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; }); print_r($array);