3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen() { for($i = 1; $i <=3; $i++) { $resp = yield $i; echo '$resp: '; var_dump($i); } $gen = gen(); foreach($gen as $out) { echo '$i: '; var_dump($i); $gen->send('Hi ' . $i); } }
Output for hhvm-3.15.4, 7.0.0 - 7.3.0rc3
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '$i' (T_VARIABLE) in /in/4Ckm8 on line 7
Process exited with code 255.