3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class CErrorException extends Exception {} function handleError($level, $message, $file, $line){ if( error_reporting() != 0){ throw new CErrorException($message, $level); } } function handleException(Exception $exception){ var_dump('Exception handled at global level'); } set_error_handler('handleError'); set_exception_handler('handleException'); try { require_once('non\existent\file'); //Will generate an error and cause an exception to be thrown. } catch (Exception $e) { var_dump("let's deal with the exception"); }
Output for 7.0.0 - 7.1.0
Warning: Uncaught CErrorException: require_once(non\existent\file): failed to open stream: No such file or directory in /in/0YtHR:7 Stack trace: #0 /in/0YtHR(20): handleError(2, 'require_once(no...', '/in/0YtHR', 20, Array) #1 /in/0YtHR(20): require_once() #2 {main} thrown in /in/0YtHR on line 7 Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/0YtHR on line 20
Process exited with code 255.
Output for 5.3.18 - 5.3.29, 5.4.8 - 5.6.28
Warning: Uncaught exception 'CErrorException' with message 'require_once(non\existent\file): failed to open stream: No such file or directory' in /in/0YtHR:7 Stack trace: #0 /in/0YtHR(20): handleError(2, 'require_once(no...', '/in/0YtHR', 20, Array) #1 /in/0YtHR(20): require_once() #2 {main} thrown in /in/0YtHR on line 7 Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/0YtHR on line 20
Process exited with code 255.
Output for 5.3.3 - 5.3.17, 5.4.0 - 5.4.7
Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/0YtHR on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.2
Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/0YtHR on line 0
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/0YtHR on line 23
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/0YtHR on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/0YtHR on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0YtHR on line 7
Process exited with code 255.