我有以下要排序的多维数组。
我想按 total_points 对最里面的数组进行排序,然后是 tiebraker1、2 和 3
例子:
Array
(
[1] => Array
(
[1] => Array
(
[userid] => 17
[total_points] => 16
[tiebraker1] => 1
[tiebraker2] => 2
[tiebraker3] => 1
)
[2] => Array
(
[userid] => 29
[total_points] => 16
[tiebraker1] => 1
[tiebraker2] => 2
[tiebraker3] => 9
)
)
[2] => Array
(
[1] => Array
(
[userid] => 26
[total_points] => 26
[tiebraker1] => 2
[tiebraker2] => 2
[tiebraker3] => 4
)
[2] => Array
(
[userid] => 17
[total_points] => 26
[tiebraker1] => 3
[tiebraker2] => 2
[tiebraker3] => 4
)
)
)
结果:
Array
(
[1] => Array
(
[1] => Array
(
[userid] => 29
[total_points] => 16
[tiebraker1] => 1
[tiebraker2] => 2
[tiebraker3] => 9
)
[2] => Array
(
[userid] => 17
[total_points] => 16
[tiebraker1] => 1
[tiebraker2] => 2
[tiebraker3] => 1
)
)
[2] => Array
(
[1] => Array
(
[userid] => 17
[total_points] => 26
[tiebraker1] => 3
[tiebraker2] => 2
[tiebraker3] => 4
)
[2] => Array
(
[userid] => 26
[total_points] => 26
[tiebraker1] => 2
[tiebraker2] => 2
[tiebraker3] => 4
)
)
)
我尝试使用 array_multisort 但我无法正确配置它。
在此先感谢您的帮助!