3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo() { yield 1; yield 2; } function bar($foo) { yield from $foo; yield 3; } $foo = foo(); $bar = bar($foo); $bar->next(); $foo->next(); foreach ($bar as $v) { var_dump($v); }
based on Xs08X
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Exception: Cannot rewind a generator that was already run in /in/LpeXK:20 Stack trace: #0 {main} thrown in /in/LpeXK on line 20
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected '$foo' (T_VARIABLE) in /in/LpeXK on line 11
Process exited with code 255.
Output for 5.4.9 - 5.4.45
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/LpeXK on line 5
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_LNUMBER in /in/LpeXK on line 5
Process exited with code 255.