/* 二维数组按指定的键值排序 * $array 数组* $key排序键值* $type排序方式* @edit: bbs.it-home.org*/function array_sort($arr, $keys, $type = 'desc') { $keysvalue = $new_array = array(); foreach ($arr as $k => $v) { $keysvalue[$k] = $v[$keys]; } if ($type == 'asc') { asort($keysvalue); } else { arsort($keysvalue); } reset($keysvalue); foreach ($keysvalue as $k => $v) { $new_array[$k] = $arr[$k]; } return $new_array; } 复制代码 >>> 更多内容,请查看 php数组排序方法大全