分享一种二维数组排序的简单方法
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function array_sort($arr,$field,$by=SORT_ASC) { foreach($arr as $v) { $r[] = $v[$field]; } array_multisort($r,$by,$arr); return $arr; } $array = array( array(´name´=>´手机´,´brand´=>´诺基亚´,´price´=>3000), array(´name´=>´笔记本电脑´,´brand´=>´lenovo´,´price´=>4000), ); $a=array_sort($array,´price´,SORT_DESC); echo "<pre class="brush:php;toolbar:false">"; print_r($a);