note 104116 added to function.filter-var-array
| From: | richard dot bouchacourt at gmail dot com | Date: | Tue, 24 May 2011 15:43:21 +0000 |
| Subject: | note 104116 added to function.filter-var-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180000@lists.php.net to get a copy of this message | ||
but this code works with numeric keys in the $input array :
$args = array(
'foo' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_REQUIRE_ARRAY,
'options' => array('min_range' => 1, 'max_range' => 4)
),
'bar' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_REQUIRE_SCALAR
)
);
$input = array(
'foo'=>array(1,2,3,4)
);
$filtered = filter_var_array($input, $args);
var_dump($filtered);
// results
array
'foo' =>
array
0 => int 1
1 => int 2
2 => int 3
3 => int 4
'bar' => null
----
Server IP: 89.31.146.176
Probable Submitter: 82.216.39.212
----
Manual Page -- http://www.php.net/manual/en/function.filter-var-array.php
Edit -- https://master.php.net/note/edit/104116
Del: integrated -- https://master.php.net/note/delete/104116/integrated
Del: useless -- https://master.php.net/note/delete/104116/useless
Del: bad code -- https://master.php.net/note/delete/104116/bad+code
Del: spam -- https://master.php.net/note/delete/104116/spam
Del: non-english -- https://master.php.net/note/delete/104116/non-english
Del: in docs -- https://master.php.net/note/delete/104116/in+docs
Del: other reasons-- https://master.php.net/note/delete/104116
Reject -- https://master.php.net/note/reject/104116
Search -- https://master.php.net/manage/user-notes.php