abstract:$arr = [ ['id'=>01, 'name'=>'赵丽颖', 'grade'=>98], ['id'=>01, 'name'=>'唐嫣', &
$arr = [
['id'=>01, 'name'=>'赵丽颖', 'grade'=>98],
['id'=>01, 'name'=>'唐嫣', 'grade'=>75],
['id'=>01, 'name'=>'杨幂', 'grade'=>78],
['id'=>01, 'name'=>'热巴', 'grade'=>88],
];
uasort($arr,function($m,$n){
// return strcmp($n['grade'],$m['grade']); // 降序
return strcmp($m['grade'],$n['grade']); // 升序
});
echo '
';
print_r($arr);Correcting teacher:天蓬老师Correction time:2019-03-22 10:39:25
Teacher's summary:内置的数组排序是针对平面数组的, 对于二维或更多维度的,只能自定义方法