`ksort` 按照ACSII码排序 ~~~ $arr = ['a','d','c','f']; ksort($arr); $arr1 = ['b' => '张三','afc' => '科比']; ksort($arr1); ~~~ ![](https://img.kancloud.cn/c2/bd/c2bdeacfd64e6456181326d6e295d5cd_280x35.png) ![](https://img.kancloud.cn/c7/b2/c7b2bd26e3040d41de14b246227b3112_272x36.png) ***** `array_multisort` 二维数组根据键排序 ~~~ $array[] = ['age' => 20,'name' => 'a']; $array[] = ['age' => 18,'name' => 'b']; $array[] = ['age' => 21,'name' => 'c']; $array[] = ['age' => 22,'name' => 'd']; foreach($array as $value){ $age[] = $value['age']; $name[] = $value['name']; } array_multisort($name,SORT_DESC,SORT_STRING,$array); return json($array); ~~~ ![](https://img.kancloud.cn/22/9a/229ad75f25d8d10138981a783f3cc11a_738x40.png) *****