Skip to content

Instantly share code, notes, and snippets.

@bhrdn
Last active March 10, 2018 12:26
Show Gist options
  • Save bhrdn/33b95af06f653f3a891c649df82fd3bc to your computer and use it in GitHub Desktop.
Save bhrdn/33b95af06f653f3a891c649df82fd3bc to your computer and use it in GitHub Desktop.
<?php
global $a, $b;
list($foo, $bar) = [
[1, 2, 9, 9, 9, 9],
[6, 5, 4, 3, 2, 7],
];
foreach (range(0, count($foo) - 1) as $x => $y) {
((($foo[$x] <=> $bar[$x]) > 0) ? $a++ : $b++); // (foo[index] - bar[index]) || if (foo > 0) then a++ or b++
}
printf("[*] Result: %s" . PHP_EOL, (($a == $b) ? 'Draw' : (($a > $b) ? 'Foo' : 'Bar')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment