note 71034 added to function.filter-var-array
| From: | aa at osu1 dot php dot net | Date: | Thu, 09 Nov 2006 09:45:16 +0000 |
| Subject: | note 71034 added to function.filter-var-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119540@lists.php.net to get a copy of this message | ||
the example (1) does not work.
<?php
error_reporting(E_ALL | E_STRICT);
$data = array(
'product_id' => 'libgd<script>',
'component' => '10',
'versions' => '2.0.33',
'testscalar' => array('2', '23', '10', '12'),
'testarray' => '2',
);
$args = array(
'product_id' => FILTER_SANITIZE_ENCODED,
'component' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_FORCE_ARRAY,
'options' => array('min_range' => 1, 'max_range' => 10)
),
'versions' => FILTER_SANITIZE_ENCODED,
'doesnotexist' => FILTER_VALIDATE_INT,
'testscalar' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_REQUIRE_SCALAR
),
'testarray' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_FORCE_ARRAY
)
);
$myinputs = filter_var_array($data, $args);
var_dump($myinputs);
echo "\n";
?>
array(6) {
["product_id"]=>
string(17) "libgd%3Cscript%3E"
["component"]=>
array(1) {
[0]=>
int(10)
}
["versions"]=>
string(6) "2.0.33"
["doesnotexist"]=>
NULL
["testscalar"]=>
bool(false)
["testarray"]=>
array(1) {
[0]=>
int(2)
}
}
----
Server IP: 217.160.72.57
Probable Submitter: 85.178.58.116
----
Manual Page -- http://www.php.net/manual/en/function.filter-var-array.php
Edit -- https://master.php.net/note/edit/71034
Del: integrated -- https://master.php.net/note/delete/71034/integrated
Del: useless -- https://master.php.net/note/delete/71034/useless
Del: bad code -- https://master.php.net/note/delete/71034/bad+code
Del: spam -- https://master.php.net/note/delete/71034/spam
Del: non-english -- https://master.php.net/note/delete/71034/non-english
Del: in docs -- https://master.php.net/note/delete/71034/in+docs
Del: other reasons-- https://master.php.net/note/delete/71034
Reject -- https://master.php.net/note/reject/71034
Search -- https://master.php.net/manage/user-notes.php