二维数组排序

$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);

}

你可能感兴趣的:(二维数组排序)