?>
主要就是利用数组的key进行排序,然后按照key排序的数组在循环原来的数组即可。
打印的结果如下:
Array
(
[0] => Array
(
[volume] => 67
[edition] => 2
)
[1] => Array
(
[volume] => 86
[edition] => 1
)
[2] => Array
(
[volume] => 85
[edition] => 6
)
[3] => Array
(
[volume] => 98
[edition] => 2
)
[4] => Array
(
[volume] => 86
[edition] => 6
)
[5] => Array
(
[volume] => 67
[edition] => 7
)
)
Array
(
[0] => 67
[1] => 86
[2] => 85
[3] => 98
[4] => 86
[5] => 67
)
=====
Array
(
[3] => 98
[4] => 86
[1] => 86
[2] => 85
[5] => 67
[0] => 67
)
Array
(
[3] => Array
(
[volume] => 98
[edition] => 2
)
[4] => Array
(
[volume] => 86
[edition] => 6
)
[1] => Array
(
[volume] => 86
[edition] => 1
)
[2] => Array
(
[volume] => 85
[edition] => 6
)
[5] => Array
(
[volume] => 67
[edition] => 7
)
[0] => Array
(
[volume] => 67
[edition] => 2
)
)