<?php
$regions = [
'int' => 1,
'nl' => 2,
'be' => 4,
'us' => 8,
'as' => 16,
'za' => 32,
];
for ($i = 0; ++$i < 1 << count($regions); array_walk($regions, function ($x, $region) use (&$list, $i) { if (!($i & $x)) return; if (isset($list[$region])) $list[$region] .= ",$i"; else $list[$region] = $i; }));
var_dump($list);
unset($list);
foreach ($regions as $region => $x)
for ($i = $x; end($regions) << 1 - $i > 0; ++$i%$x?:$i+=$x)
if (isset($list[$region]))
$list[$region] .= ",$i";
else
$list[$region] = $i;
var_dump($list);
- Output for 7.0.0 - 7.0.8, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.3 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- array(6) {
["int"]=>
string(90) "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63"
["nl"]=>
string(91) "2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47,50,51,54,55,58,59,62,63"
["be"]=>
string(91) "4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31,36,37,38,39,44,45,46,47,52,53,54,55,60,61,62,63"
["us"]=>
string(93) "8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31,40,41,42,43,44,45,46,47,56,57,58,59,60,61,62,63"
["as"]=>
string(95) "16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
["za"]=>
string(95) "32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
}
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in /in/LOcLr:19
Stack trace:
#0 {main}
thrown in /in/LOcLr on line 19
Process exited with code 255. - Output for 5.4.1 - 5.4.4, 5.4.6 - 5.4.45, 5.5.0 - 5.5.18, 5.5.20 - 5.5.37, 5.6.0 - 5.6.23
- array(6) {
["int"]=>
string(90) "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63"
["nl"]=>
string(91) "2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47,50,51,54,55,58,59,62,63"
["be"]=>
string(91) "4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31,36,37,38,39,44,45,46,47,52,53,54,55,60,61,62,63"
["us"]=>
string(93) "8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31,40,41,42,43,44,45,46,47,56,57,58,59,60,61,62,63"
["as"]=>
string(95) "16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
["za"]=>
string(95) "32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
}
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 66846673 bytes) in /in/LOcLr on line 21
Process exited with code 255. - Output for 5.4.0, 5.4.5, 5.5.19
- array(6) {
["int"]=>
string(90) "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63"
["nl"]=>
string(91) "2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47,50,51,54,55,58,59,62,63"
["be"]=>
string(91) "4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31,36,37,38,39,44,45,46,47,52,53,54,55,60,61,62,63"
["us"]=>
string(93) "8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31,40,41,42,43,44,45,46,47,56,57,58,59,60,61,62,63"
["as"]=>
string(95) "16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
["za"]=>
string(95) "32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"
}
Process exited with code 137. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/LOcLr on line 3
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '[' in /in/LOcLr on line 3
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/LOcLr on line 3
Process exited with code 255.
preferences:
309.07 ms | 401 KiB | 337 Q