3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function g1() { yield 1; yield 2; } function g2($g1) { yield from $g1; echo "!\n"; yield 3; } $g1 = g1(); $g2 = g2($g1); while ($g2->valid()) { var_dump($g2->current()); $g2->next(); }
based on TtkSg
Output for 7.0.0 - 7.2.0
int(1) int(2) ! int(3)
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected '$g1' (T_VARIABLE) in /in/Hj7J0 on line 9
Process exited with code 255.
Output for 5.4.9 - 5.4.45
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/Hj7J0 on line 4
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_LNUMBER in /in/Hj7J0 on line 4
Process exited with code 255.