3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_num_range(int $num) { if ($num < 0 || $num > 100) trigger_error('Invalid range'); } // Somewhere far from function definition. $num = "hundrets of dogs"; // Somewhere far from $num definition. check_num_range($num); // Trying to check validity, int and range. echo 'You have '.$num. ' now <br />'; // But $num could have any string. // "check_num_range((int)$num)" wouldn't help also.
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: check_num_range(): Argument #1 ($num) must be of type int, string given, called in /in/UStfP on line 7 and defined in /in/UStfP:2 Stack trace: #0 /in/UStfP(7): check_num_range('hundrets of dog...') #1 {main} thrown in /in/UStfP on line 2
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:
132.6 ms | 406 KiB | 5 Q