3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function printer() { yield; } $printer = printer(); $printer->send(3); foreach($printer as $v) { var_dump($v); }
based on 3MGUA
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Exception: Cannot traverse an already closed generator in /in/mPuO1:8 Stack trace: #0 {main} thrown in /in/mPuO1 on line 8
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'Cannot traverse an already closed generator' in /in/mPuO1:8 Stack trace: #0 /in/mPuO1(8): unknown() #1 {main} thrown in /in/mPuO1 on line 8
Process exited with code 255.
Output for 5.0.0 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/mPuO1 on line 3 Fatal error: Call to a member function send() on a non-object in /in/mPuO1 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Use of undefined constant yield - assumed 'yield' in /in/mPuO1 on line 3 Fatal error: Call to a member function on a non-object in /in/mPuO1 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant yield - assumed 'yield' in /in/mPuO1 on line 3 Fatal error: Call to a member function on a non-object in /in/mPuO1 on line 7