note 117861 added to filter.filters.validate
| From: | Inigo | Date: | Fri, 21 Aug 2015 19:54:50 +0000 |
| Subject: | note 117861 added to filter.filters.validate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203411@lists.php.net to get a copy of this message | ||
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
----
Server IP: 72.52.91.14
Probable Submitter: 213.93.30.232
----
Manual Page -- http://php.net/manual/en/filter.filters.validate.php
Edit -- https://master.php.net/note/edit/117861
Del: integrated -- https://master.php.net/note/delete/117861/integrated
Del: useless -- https://master.php.net/note/delete/117861/useless
Del: bad code -- https://master.php.net/note/delete/117861/bad+code
Del: spam -- https://master.php.net/note/delete/117861/spam
Del: non-english -- https://master.php.net/note/delete/117861/non-english
Del: in docs -- https://master.php.net/note/delete/117861/in+docs
Del: other reasons-- https://master.php.net/note/delete/117861
Reject -- https://master.php.net/note/reject/117861
Search -- https://master.php.net/manage/user-notes.php