//数组 按值进行排序 function arraySequence($array, $field, $sort = 'SORT_DESC') { $arrSort = array(); foreach ($array as $uniqid => $row) { foreach ($row as $key => $value) { //如果没有该键,默认为0 if(!array_key_exists($field,$row)){ $arrSort[$field][$uniqid] = 0; }else{ $arrSort[$key][$uniqid] = $value; } } } array_multisort($arrSort[$field], constant($sort), $array); return $array; }
二维数组中 按field的值继续排序,返回新的数组