3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test() { echo '1' . yield . '|'; echo '2' . yield . '|'; } $val = test(); //echo $val->current(); $val->send('ok'); $val->send('ok'); //echo "|" . $val->current() . "|"; //$val->send('yes'); //echo "|" . $val->current() . "|"; //$val->next(); //$val->current(); //$val->send('no'); //echo "|" . $val->current() . "|";
Output for 5.5.0 - 5.6.28, 7.0.0 - 7.1.0
1ok|2ok|
Output for hhvm-3.12.0
Fatal error: Uncaught Error: syntax error, unexpected T_YIELD in /in/lDRc5:5 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Fatal error: syntax error, unexpected T_YIELD in /in/lDRc5 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 5 1yield| Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 6 2yield| Fatal error: Call to a member function send() on a non-object in /in/lDRc5 on line 11
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/lDRc5 on line 20
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 5 1yield| Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 6 2yield| Fatal error: Call to a member function on a non-object in /in/lDRc5 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 5 1yield| Notice: Use of undefined constant yield - assumed 'yield' in /in/lDRc5 on line 6 2yield| Fatal error: Call to a member function on a non-object in /in/lDRc5 on line 11