3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php spl_autoload_register(function ($class_name) { echo "Need to include `{$class_name}` \n"; }); try { try { throw new \RuntimeException('Error message'); } finally { try { echo 'Start finally block' . PHP_EOL; $foo = new Foo(); echo 'End finally block' . PHP_EOL; } catch (Throwable $ex) { echo 'Finally catch ' . $ex->getMessage() . PHP_EOL; throw $ex; } } } catch (\Exception $e) { echo $e->getMessage() . PHP_EOL; echo $e . PHP_EOL; }
based on 5ODvX
Output for 7.1.0 - 7.2.0
Start finally block Need to include `Foo` Finally catch Class 'Foo' not found Fatal error: Uncaught RuntimeException: Error message in /in/9LAdX:8 Stack trace: #0 {main} Next Error: Class 'Foo' not found in /in/9LAdX:14 Stack trace: #0 {main} thrown in /in/9LAdX on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Start finally block Need to include `Foo` Finally catch Class 'Foo' not found Fatal error: Uncaught Error: Class 'Foo' not found in /in/9LAdX:14 Stack trace: #0 {main} thrown in /in/9LAdX on line 14
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Start finally block Need to include `Foo` Fatal error: Class 'Foo' not found in /in/9LAdX on line 14
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Start finally block Need to include `Foo` Error message exception 'RuntimeException' with message 'Error message' in /in/9LAdX:8 Stack trace: #0 {main}
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'finally' (T_STRING), expecting catch (T_CATCH) in /in/9LAdX on line 9
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/9LAdX on line 9
Process exited with code 255.