实例
//usort多维数组的排序 $b = [ ['name'=>'王宝强','age'=>'32'], ['name'=>'鹿晗','age'=>'28'], ['name'=>'王俊凯','age'=>'20'], ]; usort($b,function ($u,$i){ return strcmp($u['age'],$i['age']); }); echo var_export($b);
运行实例 »
点击 "运行实例" 按钮查看在线实例
博客列表 >usort()二维数组的排序 2018.8.27
//usort多维数组的排序 $b = [ ['name'=>'王宝强','age'=>'32'], ['name'=>'鹿晗','age'=>'28'], ['name'=>'王俊凯','age'=>'20'], ]; usort($b,function ($u,$i){ return strcmp($u['age'],$i['age']); }); echo var_export($b);
点击 "运行实例" 按钮查看在线实例