3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $q = range(0, 100); $result = array(); foreach($q as $key => $value) { if (0 === $value % 2) { $obj = new StdClass(); $obj->key = $key; $obj->value = $value; $result[] = $obj; } } var_dump($result);
based on uMmj8
Output for 5.0.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
array(51) { [0]=> object(stdClass)#1 (2) { ["key"]=> int(0) ["value"]=> int(0) } [1]=> object(stdClass)#2 (2) { ["key"]=> int(2) ["value"]=> int(2) } [2]=> object(stdClass)#3 (2) { ["key"]=> int(4) ["value"]=> int(4) } [3]=> object(stdClass)#4 (2) { ["key"]=> int(6) ["value"]=> int(6) } [4]=> object(stdClass)#5 (2) { ["key"]=> int(8) ["value"]=> int(8) } [5]=> object(stdClass)#6 (2) { ["key"]=> int(10) ["value"]=> int(10) } [6]=> object(stdClass)#7 (2) { ["key"]=> int(12) ["value"]=> int(12) } [7]=> object(stdClass)#8 (2) { ["key"]=> int(14) ["value"]=> int(14) } [8]=> object(stdClass)#9 (2) { ["key"]=> int(16) ["value"]=> int(16) } [9]=> object(stdClass)#10 (2) { ["key"]=> int(18) ["value"]=> int(18) } [10]=> object(stdClass)#11 (2) { ["key"]=> int(20) ["value"]=> int(20) } [11]=> object(stdClass)#12 (2) { ["key"]=> int(22) ["value"]=> int(22) } [12]=> object(stdClass)#13 (2) { ["key"]=> int(24) ["value"]=> int(24) } [13]=> object(stdClass)#14 (2) { ["key"]=> int(26) ["value"]=> int(26) } [14]=> object(stdClass)#15 (2) { ["key"]=> int(28) ["value"]=> int(28) } [15]=> object(stdClass)#16 (2) { ["key"]=> int(30) ["value"]=> int(30) } [16]=> object(stdClass)#17 (2) { ["key"]=> int(32) ["value"]=> int(32) } [17]=> object(stdClass)#18 (2) { ["key"]=> int(34) ["value"]=> int(34) } [18]=> object(stdClass)#19 (2) { ["key"]=> int(36) ["value"]=> int(36) } [19]=> object(stdClass)#20 (2) { ["key"]=> int(38) ["value"]=> int(38) } [20]=> object(stdClass)#21 (2) { ["key"]=> int(40) ["value"]=> int(40) } [21]=> object(stdClass)#22 (2) { ["key"]=> int(42) ["value"]=> int(42) } [22]=> object(stdClass)#23 (2) { ["key"]=> int(44) ["value"]=> int(44) } [23]=> object(stdClass)#24 (2) { ["key"]=> int(46) ["value"]=> int(46) } [24]=> object(stdClass)#25 (2) { ["key"]=> int(48) ["value"]=> int(48) } [25]=> object(stdClass)#26 (2) { ["key"]=> int(50) ["value"]=> int(50) } [26]=> object(stdClass)#27 (2) { ["key"]=> int(52) ["value"]=> int(52) } [27]=> object(stdClass)#28 (2) { ["key"]=> int(54) ["value"]=> int(54) } [28]=> object(stdClass)#29 (2) { ["key"]=> int(56) ["value"]=> int(56) } [29]=> object(stdClass)#30 (2) { ["key"]=> int(58) ["value"]=> int(58) } [30]=> object(stdClass)#31 (2) { ["key"]=> int(60) ["value"]=> int(60) } [31]=> object(stdClass)#32 (2) { ["key"]=> int(62) ["value"]=> int(62) } [32]=> object(stdClass)#33 (2) { ["key"]=> int(64) ["value"]=> int(64) } [33]=> object(stdClass)#34 (2) { ["key"]=> int(66) ["value"]=> int(66) } [34]=> object(stdClass)#35 (2) { ["key"]=> int(68) ["value"]=> int(68) } [35]=> object(stdClass)#36 (2) { ["key"]=> int(70) ["value"]=> int(70) } [36]=> object(stdClass)#37 (2) { ["key"]=> int(72) ["value"]=> int(72) } [37]=> object(stdClass)#38 (2) { ["key"]=> int(74) ["value"]=> int(74) } [38]=> object(stdClass)#39 (2) { ["key"]=> int(76) ["value"]=> int(76) } [39]=> object(stdClass)#40 (2) { ["key"]=> int(78) ["value"]=> int(78) } [40]=> object(stdClass)#41 (2) { ["key"]=> int(80) ["value"]=> int(80) } [41]=> object(stdClass)#42 (2) { ["key"]=> int(82) ["value"]=> int(82) } [42]=> object(stdClass)#43 (2) { ["key"]=> int(84) ["value"]=> int(84) } [43]=> object(stdClass)#44 (2) { ["key"]=> int(86) ["value"]=> int(86) } [44]=> object(stdClass)#45 (2) { ["key"]=> int(88) ["value"]=> int(88) } [45]=> object(stdClass)#46 (2) { ["key"]=> int(90) ["value"]=> int(90) } [46]=> object(stdClass)#47 (2) { ["key"]=> int(92) ["value"]=> int(92) } [47]=> object(stdClass)#48 (2) { ["key"]=> int(94) ["value"]=> int(94) } [48]=> object(stdClass)#49 (2) { ["key"]=> int(96) ["value"]=> int(96) } [49]=> object(stdClass)#50 (2) { ["key"]=> int(98) ["value"]=> int(98) } [50]=> object(stdClass)#51 (2) { ["key"]=> int(100) ["value"]=> int(100) } }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.4.9
array(51) { [0]=> object(stdClass)(2) { ["key"]=> int(0) ["value"]=> int(0) } [1]=> object(stdClass)(2) { ["key"]=> int(2) ["value"]=> int(2) } [2]=> object(stdClass)(2) { ["key"]=> int(4) ["value"]=> int(4) } [3]=> object(stdClass)(2) { ["key"]=> int(6) ["value"]=> int(6) } [4]=> object(stdClass)(2) { ["key"]=> int(8) ["value"]=> int(8) } [5]=> object(stdClass)(2) { ["key"]=> int(10) ["value"]=> int(10) } [6]=> object(stdClass)(2) { ["key"]=> int(12) ["value"]=> int(12) } [7]=> object(stdClass)(2) { ["key"]=> int(14) ["value"]=> int(14) } [8]=> object(stdClass)(2) { ["key"]=> int(16) ["value"]=> int(16) } [9]=> object(stdClass)(2) { ["key"]=> int(18) ["value"]=> int(18) } [10]=> object(stdClass)(2) { ["key"]=> int(20) ["value"]=> int(20) } [11]=> object(stdClass)(2) { ["key"]=> int(22) ["value"]=> int(22) } [12]=> object(stdClass)(2) { ["key"]=> int(24) ["value"]=> int(24) } [13]=> object(stdClass)(2) { ["key"]=> int(26) ["value"]=> int(26) } [14]=> object(stdClass)(2) { ["key"]=> int(28) ["value"]=> int(28) } [15]=> object(stdClass)(2) { ["key"]=> int(30) ["value"]=> int(30) } [16]=> object(stdClass)(2) { ["key"]=> int(32) ["value"]=> int(32) } [17]=> object(stdClass)(2) { ["key"]=> int(34) ["value"]=> int(34) } [18]=> object(stdClass)(2) { ["key"]=> int(36) ["value"]=> int(36) } [19]=> object(stdClass)(2) { ["key"]=> int(38) ["value"]=> int(38) } [20]=> object(stdClass)(2) { ["key"]=> int(40) ["value"]=> int(40) } [21]=> object(stdClass)(2) { ["key"]=> int(42) ["value"]=> int(42) } [22]=> object(stdClass)(2) { ["key"]=> int(44) ["value"]=> int(44) } [23]=> object(stdClass)(2) { ["key"]=> int(46) ["value"]=> int(46) } [24]=> object(stdClass)(2) { ["key"]=> int(48) ["value"]=> int(48) } [25]=> object(stdClass)(2) { ["key"]=> int(50) ["value"]=> int(50) } [26]=> object(stdClass)(2) { ["key"]=> int(52) ["value"]=> int(52) } [27]=> object(stdClass)(2) { ["key"]=> int(54) ["value"]=> int(54) } [28]=> object(stdClass)(2) { ["key"]=> int(56) ["value"]=> int(56) } [29]=> object(stdClass)(2) { ["key"]=> int(58) ["value"]=> int(58) } [30]=> object(stdClass)(2) { ["key"]=> int(60) ["value"]=> int(60) } [31]=> object(stdClass)(2) { ["key"]=> int(62) ["value"]=> int(62) } [32]=> object(stdClass)(2) { ["key"]=> int(64) ["value"]=> int(64) } [33]=> object(stdClass)(2) { ["key"]=> int(66) ["value"]=> int(66) } [34]=> object(stdClass)(2) { ["key"]=> int(68) ["value"]=> int(68) } [35]=> object(stdClass)(2) { ["key"]=> int(70) ["value"]=> int(70) } [36]=> object(stdClass)(2) { ["key"]=> int(72) ["value"]=> int(72) } [37]=> object(stdClass)(2) { ["key"]=> int(74) ["value"]=> int(74) } [38]=> object(stdClass)(2) { ["key"]=> int(76) ["value"]=> int(76) } [39]=> object(stdClass)(2) { ["key"]=> int(78) ["value"]=> int(78) } [40]=> object(stdClass)(2) { ["key"]=> int(80) ["value"]=> int(80) } [41]=> object(stdClass)(2) { ["key"]=> int(82) ["value"]=> int(82) } [42]=> object(stdClass)(2) { ["key"]=> int(84) ["value"]=> int(84) } [43]=> object(stdClass)(2) { ["key"]=> int(86) ["value"]=> int(86) } [44]=> object(stdClass)(2) { ["key"]=> int(88) ["value"]=> int(88) } [45]=> object(stdClass)(2) { ["key"]=> int(90) ["value"]=> int(90) } [46]=> object(stdClass)(2) { ["key"]=> int(92) ["value"]=> int(92) } [47]=> object(stdClass)(2) { ["key"]=> int(94) ["value"]=> int(94) } [48]=> object(stdClass)(2) { ["key"]=> int(96) ["value"]=> int(96) } [49]=> object(stdClass)(2) { ["key"]=> int(98) ["value"]=> int(98) } [50]=> object(stdClass)(2) { ["key"]=> int(100) ["value"]=> int(100) } }