PHP filter_var_array() Function
Complete PHP Filter Reference
Definition and Usage
The filter_var_array() function gets multiple variables and optionally
filters them
This function is useful for filtering many values without calling filter_var()
over and over.
Returns an array of values of the requested variables on success or FALSE on
failure.
Syntax
filter_var_array(array, args)
|
| Parameter |
Description |
| array |
Required. Specifies an array with string keys
containing the data to filter |
| args |
Optional. Specifies an array of filter arguments. A
valid array key is a variable name and a valid value is
a filter ID, or an array specifying the filter,
flags and options. This parameter can also be a single filter ID, if so,
all values in the input array are filtered by the specified filter A filter ID can be an ID name (like FILTER_VALIDATE_EMAIL)
or an ID number (like 274) |
Tips and Notes
Tip: Check the Complete PHP Filter
Reference for possible filters to use with this function.
Example
<?php
$arr = array
(
"name" => "peter griffin",
"age" => "41",
"email" => "peter@example.com",
);
$filters = array
(
"name" => array
(
"filter"=>FILTER_CALLBACK,
"flags"=>FILTER_FORCE_ARRAY,
"options"=>"ucwords"
),
"age" => array
(
"filter"=>FILTER_VALIDATE_INT,
"options"=>array
(
"min_range"=>1,
"max_range"=>120
)
),
"email"=> FILTER_VALIDATE_EMAIL,
);
print_r(filter_var_array($arr, $filters));
?>
|
The output of the code should be:
Array
(
[name] => Peter Griffin
[age] => 41
[email] => peter@example.com
)
|
Complete PHP Filter Reference
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |

|
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |

|
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Promote collaboration among coworkers in your organization through project workspaces where others can efficiently find information and work together |

|
Personalize your company profile by bookmarking and organizing favorite content, uploading assets, posting photos, blogging, and more |

|
Interact with features like tagging, flagging, wikis and ratings found in the Web 2.0 Toolbox |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide. Request an
INSTANT DEMO or download a
FREE TRIAL today. |
|