run code in 200+ php & hhvm versions
Bugs & Features
<?php $regions = [ 'int' => 1, 'nl' => 2, 'be' => 4, 'us' => 8, 'as' => 16, 'za' => 32, ]; for ($i = 0; $i < 1 << count($regions); $i++) array_walk($regions, function ($x, $region) use (&$list, $i) { var_dump($x, $i); if ($i & $x == 0) return; if (isset($list[$region])) $list[$region] .= ",$i"; else $list[$region] = $i; }); var_dump($list);
Output for 5.4.0 - 7.1.10
int(1) int(0) int(2) int(0) int(4) int(0) int(8) int(0) int(16) int(0) int(32) int(0) int(1) int(1) int(2) int(1) int(4) int(1) int(8) int(1) int(16) int(1) int(32) int(1) int(1) int(2) int(2) int(2) int(4) int(2) int(8) int(2) int(16) int(2) int(32) int(2) int(1) int(3) int(2) int(3) int(4) int(3) int(8) int(3) int(16) int(3) int(32) int(3) int(1) int(4) int(2) int(4) int(4) int(4) int(8) int(4) int(16) int(4) int(32) int(4) int(1) int(5) int(2) int(5) int(4) int(5) int(8) int(5) int(16) int(5) int(32) int(5) int(1) int(6) int(2) int(6) int(4) int(6) int(8) int(6) int(16) int(6) int(32) int(6) int(1) int(7) int(2) int(7) int(4) int(7) int(8) int(7) int(16) int(7) int(32) int(7) int(1) int(8) int(2) int(8) int(4) int(8) int(8) int(8) int(16) int(8) int(32) int(8) int(1) int(9) int(2) int(9) int(4) int(9) int(8) int(9) int(16) int(9) int(32) int(9) int(1) int(10) int(2) int(10) int(4) int(10) int(8) int(10) int(16) int(10) int(32) int(10) int(1) int(11) int(2) int(11) int(4) int(11) int(8) int(11) int(16) int(11) int(32) int(11) int(1) int(12) int(2) int(12) int(4) int(12) int(8) int(12) int(16) int(12) int(32) int(12) int(1) int(13) int(2) int(13) int(4) int(13) int(8) int(13) int(16) int(13) int(32) int(13) int(1) int(14) int(2) int(14) int(4) int(14) int(8) int(14) int(16) int(14) int(32) int(14) int(1) int(15) int(2) int(15) int(4) int(15) int(8) int(15) int(16) int(15) int(32) int(15) int(1) int(16) int(2) int(16) int(4) int(16) int(8) int(16) int(16) int(16) int(32) int(16) int(1) int(17) int(2) int(17) int(4) int(17) int(8) int(17) int(16) int(17) int(32) int(17) int(1) int(18) int(2) int(18) int(4) int(18) int(8) int(18) int(16) int(18) int(32) int(18) int(1) int(19) int(2) int(19) int(4) int(19) int(8) int(19) int(16) int(19) int(32) int(19) int(1) int(20) int(2) int(20) int(4) int(20) int(8) int(20) int(16) int(20) int(32) int(20) int(1) int(21) int(2) int(21) int(4) int(21) int(8) int(21) int(16) int(21) int(32) int(21) int(1) int(22) int(2) int(22) int(4) int(22) int(8) int(22) int(16) int(22) int(32) int(22) int(1) int(23) int(2) int(23) int(4) int(23) int(8) int(23) int(16) int(23) int(32) int(23) int(1) int(24) int(2) int(24) int(4) int(24) int(8) int(24) int(16) int(24) int(32) int(24) int(1) int(25) int(2) int(25) int(4) int(25) int(8) int(25) int(16) int(25) int(32) int(25) int(1) int(26) int(2) int(26) int(4) int(26) int(8) int(26) int(16) int(26) int(32) int(26) int(1) int(27) int(2) int(27) int(4) int(27) int(8) int(27) int(16) int(27) int(32) int(27) int(1) int(28) int(2) int(28) int(4) int(28) int(8) int(28) int(16) int(28) int(32) int(28) int(1) int(29) int(2) int(29) int(4) int(29) int(8) int(29) int(16) int(29) int(32) int(29) int(1) int(30) int(2) int(30) int(4) int(30) int(8) int(30) int(16) int(30) int(32) int(30) int(1) int(31) int(2) int(31) int(4) int(31) int(8) int(31) int(16) int(31) int(32) int(31) int(1) int(32) int(2) int(32) int(4) int(32) int(8) int(32) int(16) int(32) int(32) int(32) int(1) int(33) int(2) int(33) int(4) int(33) int(8) int(33) int(16) int(33) int(32) int(33) int(1) int(34) int(2) int(34) int(4) int(34) int(8) int(34) int(16) int(34) int(32) int(34) int(1) int(35) int(2) int(35) int(4) int(35) int(8) int(35) int(16) int(35) int(32) int(35) int(1) int(36) int(2) int(36) int(4) int(36) int(8) int(36) int(16) int(36) int(32) int(36) int(1) int(37) int(2) int(37) int(4) int(37) int(8) int(37) int(16) int(37) int(32) int(37) int(1) int(38) int(2) int(38) int(4) int(38) int(8) int(38) int(16) int(38) int(32) int(38) int(1) int(39) int(2) int(39) int(4) int(39) int(8) int(39) int(16) int(39) int(32) int(39) int(1) int(40) int(2) int(40) int(4) int(40) int(8) int(40) int(16) int(40) int(32) int(40) int(1) int(41) int(2) int(41) int(4) int(41) int(8) int(41) int(16) int(41) int(32) int(41) int(1) int(42) int(2) int(42) int(4) int(42) int(8) int(42) int(16) int(42) int(32) int(42) int(1) int(43) int(2) int(43) int(4) int(43) int(8) int(43) int(16) int(43) int(32) int(43) int(1) int(44) int(2) int(44) int(4) int(44) int(8) int(44) int(16) int(44) int(32) int(44) int(1) int(45) int(2) int(45) int(4) int(45) int(8) int(45) int(16) int(45) int(32) int(45) int(1) int(46) int(2) int(46) int(4) int(46) int(8) int(46) int(16) int(46) int(32) int(46) int(1) int(47) int(2) int(47) int(4) int(47) int(8) int(47) int(16) int(47) int(32) int(47) int(1) int(48) int(2) int(48) int(4) int(48) int(8) int(48) int(16) int(48) int(32) int(48) int(1) int(49) int(2) int(49) int(4) int(49) int(8) int(49) int(16) int(49) int(32) int(49) int(1) int(50) int(2) int(50) int(4) int(50) int(8) int(50) int(16) int(50) int(32) int(50) int(1) int(51) int(2) int(51) int(4) int(51) int(8) int(51) int(16) int(51) int(32) int(51) int(1) int(52) int(2) int(52) int(4) int(52) int(8) int(52) int(16) int(52) int(32) int(52) int(1) int(53) int(2) int(53) int(4) int(53) int(8) int(53) int(16) int(53) int(32) int(53) int(1) int(54) int(2) int(54) int(4) int(54) int(8) int(54) int(16) int(54) int(32) int(54) int(1) int(55) int(2) int(55) int(4) int(55) int(8) int(55) int(16) int(55) int(32) int(55) int(1) int(56) int(2) int(56) int(4) int(56) int(8) int(56) int(16) int(56) int(32) int(56) int(1) int(57) int(2) int(57) int(4) int(57) int(8) int(57) int(16) int(57) int(32) int(57) int(1) int(58) int(2) int(58) int(4) int(58) int(8) int(58) int(16) int(58) int(32) int(58) int(1) int(59) int(2) int(59) int(4) int(59) int(8) int(59) int(16) int(59) int(32) int(59) int(1) int(60) int(2) int(60) int(4) int(60) int(8) int(60) int(16) int(60) int(32) int(60) int(1) int(61) int(2) int(61) int(4) int(61) int(8) int(61) int(16) int(61) int(32) int(61) int(1) int(62) int(2) int(62) int(4) int(62) int(8) int(62) int(16) int(62) int(32) int(62) int(1) int(63) int(2) int(63) int(4) int(63) int(8) int(63) int(16) int(63) int(32) int(63) array(6) { ["int"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" ["nl"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" ["be"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" ["us"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" ["as"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" ["za"]=> string(181) "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,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" }
Output for 5.2.3 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/drTa0 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected '[' in <b>/in/drTa0</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected '[' in <b>/in/drTa0</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/drTa0</b> on line <b>3</b><br />
Process exited with code 255.