Created
November 22, 2018 14:56
-
-
Save bramus/ff428c5e7a7862cc0ecfe6f7b11ea9bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @ref https://twitter.com/brendt_gd/status/1065534180266782721 | |
$a = range(5, 8); | |
$b = range(13,16); | |
$c = range(1,3); | |
$current = range(1,16); | |
$a = array_combine($a, array_fill(0, sizeof($a), 1)) + array_combine($current, array_fill(0, sizeof($current), 0)); | |
$b = array_combine($b, array_fill(0, sizeof($b), 1)) + array_combine($current, array_fill(0, sizeof($current), 0)); | |
$c = array_combine($c, array_fill(0, sizeof($c), 1)) + array_combine($current, array_fill(0, sizeof($current), 0)); | |
$diff = []; | |
foreach ($current as $index) { | |
if ($a[$index] xor $b[$index] xor $c[$index] xor 1) { | |
$diff[] = $index; | |
} | |
} | |
var_dump(implode(',', $diff)); // 4,9,10,11,12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment