note 104116 deleted from function.filter-var-array by danbrown
| From: | danbrown@php.net | Date: | Tue, 24 May 2011 15:44:57 +0000 |
| Subject: | note 104116 deleted from function.filter-var-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180001@lists.php.net to get a copy of this message | ||
Note Submitter: richard dot bouchacourt at gmail dot com
----
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