3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*set_exception_handler(function ($e) { var_dump($e->getMessage()); throw 1; });*/ function unhandled(Exception $e) { // set dummy handler and return previous handler $handler = set_exception_handler(function ($e) { var_dump($e); throw 1; }); // use dummy handler when no original handler is available if ($handler === null) { $handler = set_exception_handler(null); } set_exception_handler(null); try { $handler($e); } catch (Exception $e) { var_dump('foo', $e); } echo 'die'; die(255); } echo 1; unhandled(new RuntimeException('fatal error')); echo 2;
Output for git.master, git.master_jit, rfc.property-hooks
1object(RuntimeException)#1 (7) { ["message":protected]=> string(11) "fatal error" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/ktOfm" ["line":protected]=> int(33) ["trace":"Exception":private]=> array(0) { } ["previous":"Exception":private]=> NULL } Fatal error: Uncaught Error: Can only throw objects in /in/ktOfm:13 Stack trace: #0 /in/ktOfm(24): {closure}(Object(RuntimeException)) #1 /in/ktOfm(33): unhandled(Object(RuntimeException)) #2 {main} thrown in /in/ktOfm on line 13
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.09 ms | 406 KiB | 5 Q