3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught DivisionByZeroError: Division by zero in /in/3NjVB:12 Stack trace: #0 {main} thrown in /in/3NjVB on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
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.5.24 - 5.5.35, 5.6.8 - 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.

preferences:
179.98 ms | 402 KiB | 179 Q