3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function inverse($x) { if (!$x) { throw new Exception('Division by zero.'); } return 1/$x; } try { echo inverse(0) . "\n"; } finally { echo "Second finally.\n"; }
Output for 7.0.0 - 7.2.0
Second finally. Fatal error: Uncaught Exception: Division by zero. in /in/8lah9:5 Stack trace: #0 /in/8lah9(11): inverse(0) #1 {main} thrown in /in/8lah9 on line 5
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Second finally. Fatal error: Uncaught exception 'Exception' with message 'Division by zero.' in /in/8lah9:5 Stack trace: #0 /in/8lah9(11): inverse(0) #1 {main} thrown in /in/8lah9 on line 5
Process exited with code 255.
Output for 5.4.1 - 5.4.45
Parse error: syntax error, unexpected 'finally' (T_STRING), expecting catch (T_CATCH) in /in/8lah9 on line 12
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_STRING, expecting T_CATCH in /in/8lah9 on line 12
Process exited with code 255.