Created
November 24, 2016 04:53
-
-
Save phptek/1c502465c97b7ff18864b65bd2d52ff5 to your computer and use it in GitHub Desktop.
stiff
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 | |
$wanted = array(2, 4, 6); | |
$not_wanted = array(3, 5); | |
$candidates_w = $candiates_nw = []; | |
for ($i=0; $i < 100; $i++) | |
{ | |
foreach ($wanted as $w_permid) { | |
if ($w_permid & $i) { | |
$candidates_w[$i][$w_permid][] = $i; | |
} | |
} | |
foreach ($not_wanted as $nw_permid) { | |
if (!($nw_permid & $i)) { | |
$candidates_nw[$i][$nw_permid][] = $i; | |
} | |
} | |
} | |
if ($argv[2] === 'w') { | |
var_dump($candidates_w); | |
} | |
if ($argv[2] === 'nw') { | |
var_dump($candidates_nw); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment