多维数组排序

//多维数组排序
protected function sortArrByOneField(&$array,$field,$desc = true){
$fieldArr = array();
foreach ($array as $k => $v) {
$fieldArr[$k] = (float)$v[$field];
}
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array);
}
posted @ 2019-08-04 11:22  zhangsima  阅读(308)  评论(0编辑  收藏  举报