3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function a() { yield 1; return 2; } $a = a(); $a->next() var_dump($a->getReturn());
based on D4u1M
Output for 7.0.0
Parse error: syntax error, unexpected 'var_dump' (T_STRING) in /in/6WY0d on line 11
Process exited with code 255.
Output for 5.5.24 - 5.6.16
Fatal error: Generators cannot return values using "return" in /in/6WY0d on line 7
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/6WY0d on line 5
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_LNUMBER in /in/6WY0d on line 5
Process exited with code 255.