Skip to content

Instantly share code, notes, and snippets.

@marijnvdwerf
Last active December 11, 2015 23:38
Show Gist options
  • Save marijnvdwerf/4677689 to your computer and use it in GitHub Desktop.
Save marijnvdwerf/4677689 to your computer and use it in GitHub Desktop.
class Team {
public $scores = [0,1,3];
public static function compare($objectA, $objectB) {
$scoresA = $objectA->scores;
rsort($scoresA);
$scoresB = $objectB->scores;
rsort($scoresB);
for ($round = 0; $round < 3; $round++) {
$output = $scoresA[$round] - $scoresB[$round];
if($output !== 0) {
break;
}
}
return $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment