I have a multidimensional array which stores information about players in a game. It stores an array for each player, and each player is an array of information. One of the values in each player is an array of scores. I want to output my data to a table in order of highest total score to lowest.
At the moment, the output is in no particular order. The only way I know of to get the total score is array_sum($allplayers[0][2]) or similar. How can I sort the array $allplayers so that when I loop through it to output results it will start with the highest array_sum and work its way down?
Example of array:
//I want to sort $Allplayers by sum of key [3]
$Allplayers ( [0] => Array (
[0] => Winning
[1] => 224
[4] => 0
[2] => Array ( [0] => 107 [1] => 114 [3] => 104 )
[3] => Array ( [0] => 107 [1] => 114 ) )
[1] => Array (
[0] => Losing
[1] => 225
[2] => Array ( [0] => 76 )
[3] => Array ( [0] => 76 )
[4] => 1 )
usort(array_sum($allplayers[][3]),"cmp");after the function. what should I put between the first[]? That's what I don't get. Thank again