3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo() { yield; } $x = foo(); $x->throw(new stdclass);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in /in/vqMu4:4 Stack trace: #0 [internal function]: foo() #1 /in/vqMu4(8): Generator->throw(Object(stdClass)) #2 {main} thrown in /in/vqMu4 on line 4
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Exceptions must be valid objects derived from the Exception base class in /in/vqMu4 on line 8
Process exited with code 255.
Output for 5.3.18 - 5.4.45
Notice: Use of undefined constant yield - assumed 'yield' in /in/vqMu4 on line 4 Fatal error: Call to a member function throw() on a non-object in /in/vqMu4 on line 8
Process exited with code 255.