note 117861 deleted from filter.filters.validate by salathe
| From: | salathe@php.net | Date: | Tue, 16 Feb 2016 12:44:31 +0000 |
| Subject: | note 117861 deleted from filter.filters.validate by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204957@lists.php.net to get a copy of this message | ||
Note Submitter: Inigo
----
The correct way to use min_range and max_range in FILTER_VALIDATE_INT is not to just add those as
keys of an array with respective values as third parameter.
But you have to include this array as a value of the key 'options'.
i.e.
<?php
echo filter_var(5,
FILTER_VALIDATE_INT,array('min_range'=>0,'max_range'=>4)) ?
'true' :'false';
echo ' ';
echo filter_var(5, FILTER_VALIDATE_INT,array("options"
=>array('min_range'=>0,'max_range'=>4))) ? 'true'
:'false';
//output true false
?>
source: http://www.w3schools.com/php/filter_validate_int.asp