3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); set_error_handler( /** * @throws ErrorException */ static function ($errno, $errstr, $errfile, $errline): void { throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); } ); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } unset($good); var_dump(error_get_last()); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } unset($good); assert(NULL === error_get_last()); try { set_error_handler(null); @trigger_error('Oh no'); restore_error_handler(); try { @trigger_error('Oh no'); } catch (ErrorException $good) { assert('Oh no' === $good->getMessage(), get_class($good)); } finally { assert(isset($good), 'an expected exception was not thrown'); } } catch (ErrorException $fail) { assert(false, sprintf('the "%s" exception must not be thrown', get_class($fail))); } finally { assert(!isset($fail), 'there must not have been any exception'); } var_dump(error_get_last());
Output for git.master, git.master_jit, rfc.property-hooks
NULL array(4) { ["type"]=> int(1024) ["message"]=> string(5) "Oh no" ["file"]=> string(9) "/in/8fopq" ["line"]=> int(35) }

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:
127.39 ms | 405 KiB | 5 Q