3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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"; ?>
based on JELOs
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
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.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.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.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.