3v4l.org

run code in 200+ PHP versions simultaneously
<?php $count = 'z'; $count = filter_var($count, FILTER_VALIDATE_INT, ['default' => 20, 'min_range' => 1, 'max_range' => 20]); if (!$count) { $count = 20; } var_dump($count);
based on q3Hnm
Output for 7.1.25 - 7.4.0rc4
int(20)