3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeException extends Exception {} function foo() { echo 'attempting 1' . PHP_EOL; } function bar($someCondition) { echo 'attempting 2 with ' . $someCondition . PHP_EOL; if ($someCondition == null) { throw new SomeException('Foo foo fooey'); } } function baz() { echo 'attempting 3' . PHP_EOL; throw new Exception('Boo boo bar'); } function fixupforbar(&$someCondition) { $someCondition = 5; } /** main() **/ $someCondition = null; try { foo(); BAR: bar($someCondition); baz(); } catch (SomeException $e) { fixupforbar($someCondition); goto BAR; } catch (Exception $e) { echo 'Exception caught: ' . $e->getMessage() . PHP_EOL; } finally { echo 'Cleaning up' . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
attempting 1 attempting 2 with attempting 2 with 5 attempting 3 Exception caught: Boo boo bar Cleaning up

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:
46.58 ms | 401 KiB | 8 Q