3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function gen() { $gen = yield; $gen->next(); } $gen = gen(); $gen->send($gen); $gen->next(); ?>
based on 71WgQ
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Cannot resume an already running generator in /in/Y1FWT:5 Stack trace: #0 /in/Y1FWT(5): Generator->next() #1 [internal function]: gen() #2 /in/Y1FWT(9): Generator->send(Object(Generator)) #3 {main} thrown in /in/Y1FWT on line 5
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught exception 'Exception' with message 'Generator is already running' in /in/Y1FWT:5 Stack trace: #0 /in/Y1FWT(5): Generator->next() #1 (): gen() #2 /in/Y1FWT(9): Generator->send() #3 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Fatal error: Uncaught exception 'Exception' with message 'Need to call next() first' in /in/Y1FWT:9 Stack trace: #0 /in/Y1FWT(9): Generator->send() #1 {main}
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Cannot resume an already running generator in /in/Y1FWT on line 5
Process exited with code 255.
Output for 5.0.0 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/Y1FWT on line 4 Fatal error: Call to a member function next() on a non-object in /in/Y1FWT on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Use of undefined constant yield - assumed 'yield' in /in/Y1FWT on line 4 Fatal error: Call to a member function on a non-object in /in/Y1FWT on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant yield - assumed 'yield' in /in/Y1FWT on line 4 Fatal error: Call to a member function on a non-object in /in/Y1FWT on line 5