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){ 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/sKc4X:7 Stack trace: #0 /in/sKc4X(20): handleError(2, 'require_once(no...', '/in/sKc4X', 20, Array) #1 /in/sKc4X(20): require_once() #2 {main} thrown in /in/sKc4X on line 7 Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/sKc4X on line 20
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: File not found: non\existent\file in /in/sKc4X 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/sKc4X:7 Stack trace: #0 /in/sKc4X(20): handleError(2, 'require_once(no...', '/in/sKc4X', 20, Array) #1 /in/sKc4X(20): require_once() #2 {main} thrown in /in/sKc4X on line 7 Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/sKc4X 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/sKc4X 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/sKc4X on line 0
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Fatal error: main(): Failed opening required 'non\existent\file' (include_path='.:') in /in/sKc4X on line 23
Process exited with code 255.
Output for 5.0.0 - 5.2.2
<br /> <b>Fatal error</b>: main() [<a href='function.require'>function.require</a>]: Failed opening required 'non\existent\file' (include_path='.:') in <b>/in/sKc4X</b> on line <b>23</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_NEW in <b>/in/sKc4X</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_NEW in <b>/in/sKc4X</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/sKc4X</b> on line <b>7</b><br />
Process exited with code 255.