标签:数组排序 eric eve 维数 res 二维数组 function ber ==
function array_sort($arr, $field, $by = SORT_ASC){ foreach ($arr as $v) { $r[] = $v[$field]; } array_multisort($r, $by, $arr); return $arr;} function sort_array($array, $keyid, $order=‘asc‘, $type=‘number‘) { if(is_array($array)) { foreach($array as $val) { $order_arr[] = $val[$keyid]; } $order = ($order == ‘asc‘) ? SORT_ASC: SORT_DESC; $type = ($type == ‘number‘) ? SORT_NUMERIC: SORT_STRING; array_multisort($order_arr, $order, $type, $array); }} ——————————————if($res){
foreach ($res as $k=>$v) {
$res[$k][‘list_bonus‘]=$v[‘list-bonus‘];
$res[$k][‘rebate_level‘]=$v[‘active_rebate_level‘];
$qnum[$k]=$v[‘qnum‘];
$posttime[$k]=$v[‘posttime‘];
}
array_multisort($posttime,SORT_NUMERIC,SORT_DESC,$qnum,SORT_NUMERIC,SORT_DESC,$res);
}
标签:数组排序 eric eve 维数 res 二维数组 function ber ==
原文地址:http://www.cnblogs.com/csjoz/p/7244049.html