filter_var_arrayGets multiple variables and optionally filters them Description
mixed filter_var_array
( array
$data
[, mixed $definition
[, bool $add_empty = true
]] )This function is useful for retrieving many values without repetitively calling filter_var. Parameters
Return Values
An array containing the values of the requested variables on success, or Examples
Example #1 A filter_var_array example
<?phpThe above example will output:
array(6) {
["product_id"]=>
array(1) {
[0]=>
string(17) "libgd%3Cscript%3E"
}
["component"]=>
array(1) {
[0]=>
int(10)
}
["versions"]=>
array(1) {
[0]=>
string(6) "2.0.33"
}
["doesnotexist"]=>
NULL
["testscalar"]=>
bool(false)
["testarray"]=>
array(1) {
[0]=>
int(2)
}
}
Changelog
|