PHP多维数组排序

$a = Array (  
[0] => Array ( [level] => 25 [nick_name] => 王贵)  
[1] => Array ( [level] => 6 [nick_name] => 张三)  
[2] => Array ( [level] => 30 [nick_name] => 李四)  
[3] => Array ( [level] => 25 [nick_name] => 王五)  
[4] => Array ( [level] => 21 [nick_name] => 六儿)  
[5] => Array ( [level] => 9 [nick_name] => 哈哈)  
[6] => Array ( [level] => 30 [nick_name] => 呼呼)  
)

我这里有一个数组,我想根据level的值,从大到小排列,数组结构保持不变 

===================

 方法:

$t = array();
foreach($a as $v) 
{
$t[] = $v['level'];
}
array_multisort($t, SORT_DESC, $a);

print_r($a); 

posted @ 2012-05-16 15:26  王翔(kingfly)  阅读(275)  评论(0编辑  收藏  举报