3v4l.org

run code in 300+ PHP versions simultaneously
<?php function default_error_handler($errorNumber, $message, $errfile, $errline){ echo " default_error_handler:\r\n"; var_dump($errorNumber, $message, $errfile, $errline, error_get_last()); echo "/default_error_handler\r\n"; } function unexpected_shutdown_handler(){ echo " unexpected_shutdown_handler:\r\n"; var_dump(error_get_last()); echo "/unexpected_shutdown_handler\r\n"; } set_error_handler('default_error_handler'); register_shutdown_function('unexpected_shutdown_handler'); try{ $a=1/0 ; }catch(Exception $e){ echo " catch Exception:\r\n"; var_dump($e); } echo "end"; ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught DivisionByZeroError: Division by zero in /in/ZGg6l:16 Stack trace: #0 {main} thrown in /in/ZGg6l on line 16 unexpected_shutdown_handler: array(4) { ["type"]=> int(1) ["message"]=> string(94) "Uncaught DivisionByZeroError: Division by zero in /in/ZGg6l:16 Stack trace: #0 {main} thrown" ["file"]=> string(9) "/in/ZGg6l" ["line"]=> int(16) } /unexpected_shutdown_handler
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
default_error_handler: int(2) string(16) "Division by zero" string(9) "/in/ZGg6l" int(16) NULL /default_error_handler end unexpected_shutdown_handler: NULL /unexpected_shutdown_handler
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
default_error_handler: int(2) string(16) "Division by zero" string(9) "/in/ZGg6l" int(17) NULL /default_error_handler end unexpected_shutdown_handler: NULL /unexpected_shutdown_handler
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
default_error_handler: Fatal error: Call to undefined function error_get_last() in /in/ZGg6l on line 4 unexpected_shutdown_handler: Fatal error: Call to undefined function error_get_last() in /in/ZGg6l on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/ZGg6l on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '{' in /in/ZGg6l on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZGg6l on line 15
Process exited with code 255.

preferences:
217.46 ms | 401 KiB | 314 Q