php 二维数组排序

$person = array(
array('num'=>'001','id'=>6,'name'=>'zhangsan','age'=>21),
array('num'=>'001','id'=>7,'name'=>'ahangsan','age'=>23),
array('num'=>'003','id'=>1,'name'=>'bhangsan','age'=>23),
array('num'=>'001','id'=>3,'name'=>'dhangsan','age'=>23),
);
function sort_by_name($x,$y){
return strcasecmp($x['name'],$y['name']);
}

uasort($person,'sort_by_name');
var_dump($person);
posted @ 2017-03-06 14:49  azcqwezxc  阅读(92)  评论(0编辑  收藏  举报