function arraySort($arr, $keys, $type = 'asc') {//二维按照某个字段对数组排序 $keysvalue = $new_array = array(); foreach ($arr as $k => $v){ $keysvalue[$k] = $v[$keys]; } $type == 'asc' ? asort($keysvalue) : arsort($keysvalue); reset($keysvalue); foreach ($keysvalue as $k => $v) { $new_array[$k] = $arr[$k]; } return $new_array; }
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/273244.html