3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php set_error_handler(function ($errno, $errstr, $errfile, $errline) { $namespace = 'ajf\ErrorExceptions\Dynamic'; $className = implode('', explode(' ', ucwords($errstr))); eval("namespace $namespace { class $className extends \ErrorException {} }"); $fullClassName = $namespace . '\\' . $className; throw new $fullClassName($errstr, 0, $errno, $errfile, $errline); }); $foo = 1/0;
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught ajf\ErrorExceptions\Dynamic\DivisionByZero: Division by zero in /in/3NjVB:12 Stack trace: #0 /in/3NjVB(12): {closure}(2, 'Division by zer...', '/in/3NjVB', 12, Array) #1 {main} thrown in /in/3NjVB on line 12
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Uncaught exception 'ajf\ErrorExceptions\Dynamic\DivisionByZero' with message 'Division by zero' in /in/3NjVB:12 Stack trace: #0 /in/3NjVB(12): {closure}(2, 'Division by zer...', '/in/3NjVB', 12, Array) #1 {main} thrown in /in/3NjVB on line 12
Process exited with code 255.