3v4l.org

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