3v4l.org

run code in 300+ PHP versions simultaneously
<?php //creating a function containing a potential exception function checkNumber($number) { if($number > 1) { throw new Exception('The value has to be 1 or lower'); } return true; } //triggering the exception inside a try() try { checkNumber(2); //In case the exception gets thrown, this is the message that is shown. echo 'The value is 1 or lower'; } catch(Exception $e) { //catching the exception echo 'Message: ' .$e->getMessage(); }
Output for git.master, git.master_jit, rfc.property-hooks
Message: The value has to be 1 or lower

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