二维数组排序
2019-02-19 本文已影响0人
大蚂蚁_be96
$sort = array(
'direction' => 'SORT_ASC', //排序顺序标志 SORT_DESC 降序;SORT_ASC 升序
'field' => 'distance', //排序字段
);
$arrSort = array();
foreach($shop_list AS $uniqid => $row){
foreach($row AS $key=>$value){
$arrSort[$key][$uniqid] = $value;
}
}
if($sort['direction']){
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $shop_list);
}