3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function generate($to, $from, $interval) { for ($from; $from <= $to; $from += $interval) { yield $from; } } $values = generate(100, 1, 1); foreach ($values as $value) { var_dump($value); } echo "NEXT LINE";
Output for 5.5.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) int(44) int(45) int(46) int(47) int(48) int(49) int(50) int(51) int(52) int(53) int(54) int(55) int(56) int(57) int(58) int(59) int(60) int(61) int(62) int(63) int(64) int(65) int(66) int(67) int(68) int(69) int(70) int(71) int(72) int(73) int(74) int(75) int(76) int(77) int(78) int(79) int(80) int(81) int(82) int(83) int(84) int(85) int(86) int(87) int(88) int(89) int(90) int(91) int(92) int(93) int(94) int(95) int(96) int(97) int(98) int(99) int(100) NEXT LINE
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected '$from' (T_VARIABLE) in /in/UDKbo on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/UDKbo on line 5
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
Parse error: parse error, unexpected T_VARIABLE in /in/UDKbo on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/UDKbo on line 5
Process exited with code 255.