3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen() { var_dump(yield 1); var_dump(yield 2); var_dump(yield 3); } $f = gen('out'); var_dump($f->send('a')); var_dump($f->send('b')); var_dump($f->send('c'));
based on CY2uD
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0alpha1
string(1) "a" int(2) string(1) "b" int(3) string(1) "c" NULL
Output for hhvm-3.12.14 - 3.17.3
Fatal error: Uncaught Error: syntax error, unexpected T_YIELD, expecting ')' in /in/TdQ1H:4 Stack trace: #0 {main}
Process exited with code 255.