PHP二位数组根据某个字段排序
例:
$test = [
[
'sort' = 1,
'name' = 'name1',
],
[
'sort' = 3,
'name' = 'name3',
],
[
'sort' = 2,
'name' = 'name2',
],
];
$arr = array_column($test,'sort');
array_multisort($arr,SORT_DESC,$test);
var_dump($test);
//结果
$test = [
[
's
原创
2021-08-11 17:15:40 ·
134 阅读 ·
0 评论