// renamed keys so that success should show TeamA, B, C in correct order
$record['TeamC'] = array(2, 1, 0); // bottom team, they had a loss
$record['TeamB'] = array(2, 0, 0);
$record['TeamA'] = array(3, 0, 0); // top team
// Obtain a list of columns
foreach ($record as $key => $row) {
$wins[$key] = $row[0];
$losses[$key] = $row[1];
}
// Sort the data with volume descending, edition ascending
// Add $data as the last parameter, to sort by the common key
array_multisort($wins, SORT_DESC, $losses, SORT_ASC, $record);
var_dump($record);
// gives, TeamA, B, C:
array
'TeamA' =>
array
0 => int 3
1 => int 0
2 => int 0
'TeamB' =>
array
0 => int 2
1 => int 0
2 => int 0
'TeamC' =>
array
0 => int 2
1 => int 1
2 => int 0