3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function ($errno, $errstr, $errfile, $errline) { $namespace = 'ajf\ErrorExceptions\Dynamic'; $className = preg_replace('/[^a-zA-Z0-9]/g', '', preg_replace('/\:.*$/g', '', implode('', explode(' ', ucwords($errstr))))); $fullClassName = $namespace . '\\' . $className; if (!class_exists($fullClassName)) { eval("namespace $namespace { class $className extends \ErrorException {} }"); } throw new $fullClassName($errstr, 0, $errno, $errfile, $errline); }); try { $foo = 1/0; } catch (ajf\ErrorExceptions\Dynamic\DivisionByZero $e) { echo "ba-da-bing, ba-da-boom: I caught a $e!\n"; } try { $repent = sin("123abc"); } catch (ajf\ErrorExceptions\Dynamic\ANonWellFormedNumericValueEncountered $e) { echo "praise be to zend_is_numeric_string_ex: $e"; } try { $empty = []; $void = $empty["soul"]; } catch (ajf\ErrorExceptions\Dynamic\UndefinedOffset $e) { echo "not even the colon can defeat me: $e"; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught DivisionByZeroError: Division by zero in /in/jqjAl:15 Stack trace: #0 {main} thrown in /in/jqjAl on line 15
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:
49.33 ms | 401 KiB | 8 Q