I have an array of players, which are arrays themselves and I want to sort by score.
[player_info] => Array
(
[0] => Array
(
[player_] => âlêj!!tâ~ôk
[score_] => 66
[ping_] =>
[team_] => Blue
)
[1] => Array
(
[player_] => alejitbella
[score_] => 3
[ping_] =>
[team_] => Blue
)
[2] => Array
(
[player_] => §Uph§£lMejo
[score_] => 34
[ping_] =>
[team_] => Red
)
[3] => Array
(
[player_] => timoleon
[score_] => 10
[ping_] =>
[team_] => Red
)
)
I've already managed to get usort working properly (not shown in the example above) however I need to preserve placement of teams. Let's say Simon, Becky, Alek, and George are here.
Simon 25 Red
Becky 13 Red
Alek 3 Blue
George 5 Blue
I want to be able to arrange them by score high to low, while preserving their location in the array based on team.
How might I accomplish this?
EDIT: Due to people thinking this is a duplicate I need to clarify.
I want to order these by score while preserving the order of the team "Red" and "Blue"
Basically I want to turn the above example into Simon 25 Red Becky 13 Red George 5 Blue Alek 3 Blue