3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen() { echo "[1] Incoming value: ".yield.PHP_EOL; echo "[2] Incoming value: ".yield.PHP_EOL; echo "[3] Incoming value: ".yield.PHP_EOL; echo "[4] Incoming value: ".yield.PHP_EOL; echo "[5] Incoming value: ".yield.PHP_EOL; } $x = gen(); $x->send(5); $x->send(4); $x->send(3); $x->send(2); $x->send(1);
based on 4lDc2
Output for 5.5.24 - 7.2.0
[1] Incoming value: 5 [2] Incoming value: 4 [3] Incoming value: 3 [4] Incoming value: 2 [5] Incoming value: 1
Output for 5.0.2 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 3 [1] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 4 [2] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 5 [3] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 6 [4] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 7 [5] Incoming value: yield Fatal error: Call to a member function send() on a non-object in /in/nfZkO on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 3 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 3 [1] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 4 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 4 [2] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 5 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 5 [3] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 6 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 6 [4] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 7 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 7 [5] Incoming value: yieldPHP_EOL Fatal error: Call to a member function send() on a non-object in /in/nfZkO on line 11
Process exited with code 255.
Output for 4.3.10 - 4.4.9
Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 3 [1] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 4 [2] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 5 [3] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 6 [4] Incoming value: yield Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 7 [5] Incoming value: yield Fatal error: Call to a member function on a non-object in /in/nfZkO on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.9
Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 3 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 3 [1] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 4 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 4 [2] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 5 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 5 [3] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 6 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 6 [4] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 7 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 7 [5] Incoming value: yieldPHP_EOL Fatal error: Call to a member function on a non-object in /in/nfZkO 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/nfZkO on line 3 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 3 [1] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 4 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 4 [2] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 5 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 5 [3] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 6 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 6 [4] Incoming value: yieldPHP_EOL Notice: Use of undefined constant yield - assumed 'yield' in /in/nfZkO on line 7 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/nfZkO on line 7 [5] Incoming value: yieldPHP_EOL Fatal error: Call to a member function on a non-object in /in/nfZkO on line 11