php中array_multisort对多维数组排序的方法
本文实例讲述了php中array_multisort对多维数组排序的方法。分享给大家供大家参考。具体实现方法如下:
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); } }
希望本文所述对大家的php程序设计有所帮助。
相关推荐
ztyzly00 2020-07-18
killgod 2020-06-14
小惠 2020-06-05
Oudasheng 2020-06-04
从零开始 2020-06-05
litterfrog 2020-05-30
老谢的自留地 2020-05-09
wulaxiaohei 2020-05-05
cyyking 2020-05-03
aaLiweipeng 2020-04-15
wordmhg 2020-04-09
wangqing 2020-04-06
Pinkr 2020-03-12
dushine00 2020-02-21
dbhllnr 2020-02-18
zhujiangtaotaise 2020-01-26
chenchuang 2020-01-25
troysps 2020-01-24