3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function get_gen() { echo "Starting generator\n"; $a = yield + 1; echo $a . "\n"; } $gen = get_gen(); $gen->send(1);
based on rFJWQ
Output for 7.0.0 - 7.2.0
Starting generator 1
Output for 5.5.24 - 5.6.28
Starting generator 2
Output for 5.3.18 - 5.4.45
Starting generator Notice: Use of undefined constant yield - assumed 'yield' in /in/67eSO on line 5 1 Fatal error: Call to a member function send() on a non-object in /in/67eSO on line 10
Process exited with code 255.