3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function printer() { yield; } $printer = printer(); $printer->send(33); foreach($printer as $v) { var_dump($v); }
based on mHBbX
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Exception: Cannot traverse an already closed generator in /in/QS3Us:9 Stack trace: #0 {main} thrown in /in/QS3Us on line 9
Process exited with code 255.
Output for hhvm-3.12.0 - 3.13.2
Output for hhvm-3.10.0
Fatal error: Uncaught exception 'Exception' with message 'Need to call next() first' in /in/QS3Us:7 Stack trace: #0 /in/QS3Us(7): Generator->send() #1 {main}
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'Cannot traverse an already closed generator' in /in/QS3Us:9 Stack trace: #0 /in/QS3Us(9): unknown() #1 {main} thrown in /in/QS3Us on line 9
Process exited with code 255.
Output for 5.0.0 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/QS3Us on line 3 Fatal error: Call to a member function send() on a non-object in /in/QS3Us 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/QS3Us on line 3 Fatal error: Call to a member function on a non-object in /in/QS3Us 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/QS3Us on line 3 Fatal error: Call to a member function on a non-object in /in/QS3Us on line 7