I have the following multi-dimensional array that I want to sort.
I want to sort the innermost arrays by total_points, then tiebraker1, 2 and 3
Example:
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
)
)
)
Result:
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
)
)
)
I tried using array_multisort but I cant configure it correctly.
Thanks in advance for your help!