3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class NonFatalException extends Exception { } try { throw new NonFatalException("hello"); } catch(SomeException $e) { // some error handling } catch(NonFatalException $e) { echo "caught nonfatal"; throw $e; } catch (Exception $e) { echo "caught general"; }
Output for 7.0.0 - 7.1.0
caught nonfatal Fatal error: Uncaught NonFatalException: hello in /in/WA8Vg:7 Stack trace: #0 {main} thrown in /in/WA8Vg on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
caught nonfatal Fatal error: Uncaught exception 'NonFatalException' with message 'hello' in /in/WA8Vg:7 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.1.0 - 5.6.28
caught nonfatal Fatal error: Uncaught exception 'NonFatalException' with message 'hello' in /in/WA8Vg:7 Stack trace: #0 {main} thrown in /in/WA8Vg on line 7
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Class 'SomeException' not found in /in/WA8Vg on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/WA8Vg on line 6
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/WA8Vg on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WA8Vg on line 6
Process exited with code 255.