感谢作者的方法
转载连接:http://www.cnblogs.com/fengliang/p/6193234.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
$array = [
'2' => [
'title' => 'Flower',
'order' => 3
],
'3' => [
'title' => 'Rock',
'order' => 1
],
'4' => [
'title' => 'Grass',
'order' => 2
]
];
$keys = array_keys($array);
array_multisort(
array_column($array, 'order'), SORT_DESC, SORT_NUMERIC, $array, $keys
);
$array = array_combine($keys, $array);
print_r($array);
|