3v4l.org

run code in 300+ PHP versions simultaneously
<?php function inverse($x) { if (!$x) { throw new Exception('Division by zero.'); }else{ return 1/0; } } try { echo inverse(true) . "\n"; } catch (Exception $e) { echo 'Caught exception: '.__FILE__.', '.__LINE__.$e->getMessage()."\n"; } finally { echo "First finally.\n"; } try { echo inverse(false) . "\n"; } catch (Exception $e) { echo 'Caught exception: '.__FILE__.', '.__LINE__.$e->getMessage()."\n"; } finally { echo "Second finally.\n"; } // Continue execution echo "Hello World\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
First finally. Fatal error: Uncaught DivisionByZeroError: Division by zero in /in/sJat2:6 Stack trace: #0 /in/sJat2(11): inverse(true) #1 {main} thrown in /in/sJat2 on line 6
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.75 ms | 401 KiB | 8 Q