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.

preferences:
25.78 ms | 404 KiB | 5 Q