3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php try { try { throw new \RuntimeException('Error message'); } finally { try { echo 'Start finally' . PHP_EOL; $foo = new \Foo(); echo 'End finally' . PHP_EOL; } catch (\Exception $e) { echo 'Catch in finally' . PHP_EOL; throw $e; } } } catch (\Exception $e) { echo $e->getMessage() . PHP_EOL; echo $e . PHP_EOL; }
Output for 7.1.0 - 7.2.0
Start finally Fatal error: Uncaught RuntimeException: Error message in /in/cZFD9:4 Stack trace: #0 {main} Next Error: Class 'Foo' not found in /in/cZFD9:8 Stack trace: #0 {main} thrown in /in/cZFD9 on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Start finally Fatal error: Uncaught Error: Class 'Foo' not found in /in/cZFD9:8 Stack trace: #0 {main} thrown in /in/cZFD9 on line 8
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Start finally Fatal error: Class 'Foo' not found in /in/cZFD9 on line 8
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Start finally
Process exited with code 139.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'finally' (T_STRING), expecting catch (T_CATCH) in /in/cZFD9 on line 5
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_STRING, expecting T_CATCH in /in/cZFD9 on line 5
Process exited with code 255.