I wanted to use the php filer_var function but it’s returning a wrong result, it seems that it doesn’t take into account the range:
$v = 54;
$int_opts = array (
'min_range' => 0,
'max_range' => 24
);
if ( filter_var($v, FILTER_VALIDATE_INT, $int_opts) ) echo 'an integer';
else echo 'not an integer';
This shouldn’t be an integer as 54 is not between 0 and 24, but it returns true and echoes “an integer”.
What’s the problem here?
Thanks.
The “options” array needs to have a member named “options”. From the manual:
you’re not passing that so the behaviour displayed is okay.