3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen() : \Generator { $str = ''; while (FALSE !== $v = yield) { $str .= $v; } print "$str\n"; } $gen = gen(); $gen->send('Hello'); $gen->send(' '); $gen->send('world'); $gen->send(FALSE);
based on PrEfN
Output for 7.0.0 - 7.3.0beta1
Hello world
Output for hhvm-3.12.14 - 3.17.3
Fatal error: Uncaught Error: syntax error, unexpected T_YIELD in /in/gcKD7:5 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/gcKD7 on line 3
Process exited with code 255.