3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $scores = array( "Mike" => array(04, 03, 00, 07, 04, 07, 00, 01, 00, 07, 04), "Kyle" => array(07, 01, 00, 03, 04, 01, 00, 07, 03, 04, 04), "Johnny" => array(07, 07, 00, 03, 00, 04, 00, 01, 01, 04, 03), "Will" => array(03, 04, 00, 03, 04, 07, 00, 01, 00, 07, 04), "Vasques" => array(03, 01, 00, 03, 04, 07, 00, 01, 00, 07, 07) ); function cmp($a, $b) { return array_sum($b) - array_sum($a); } usort($scores, "cmp"); print_r($scores);
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [0] => 4 [1] => 3 [2] => 0 [3] => 7 [4] => 4 [5] => 7 [6] => 0 [7] => 1 [8] => 0 [9] => 7 [10] => 4 ) [1] => Array ( [0] => 7 [1] => 1 [2] => 0 [3] => 3 [4] => 4 [5] => 1 [6] => 0 [7] => 7 [8] => 3 [9] => 4 [10] => 4 ) [2] => Array ( [0] => 3 [1] => 4 [2] => 0 [3] => 3 [4] => 4 [5] => 7 [6] => 0 [7] => 1 [8] => 0 [9] => 7 [10] => 4 ) [3] => Array ( [0] => 3 [1] => 1 [2] => 0 [3] => 3 [4] => 4 [5] => 7 [6] => 0 [7] => 1 [8] => 0 [9] => 7 [10] => 7 ) [4] => Array ( [0] => 7 [1] => 7 [2] => 0 [3] => 3 [4] => 0 [5] => 4 [6] => 0 [7] => 1 [8] => 1 [9] => 4 [10] => 3 ) )