3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump((function () { for ($i = 0; $i < 5; $i++) { try { return $i; } finally { try { if ($i != 3) throw Exception; } catch (Exception $e) {} } } })());
based on Gtvjv
Output for 7.2.0
Warning: Use of undefined constant Exception - assumed 'Exception' (this will throw an Error in a future version of PHP) in /in/5NBc5 on line 8 Fatal error: Uncaught Error: Can only throw objects in /in/5NBc5:8 Stack trace: #0 /in/5NBc5(12): {closure}() #1 {main} thrown in /in/5NBc5 on line 8
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant Exception - assumed 'Exception' in /in/5NBc5 on line 8 Fatal error: Uncaught Error: Can only throw objects in /in/5NBc5:8 Stack trace: #0 /in/5NBc5(12): {closure}() #1 {main} thrown in /in/5NBc5 on line 8
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/5NBc5 on line 12
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'finally' (T_STRING), expecting catch (T_CATCH) in /in/5NBc5 on line 6
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/5NBc5 on line 6
Process exited with code 255.