PHP filter_var_array() Function

PHP filter_var_array Function


Define :

In this tutorial we have to learned about PHP filter_var_array() Function.
The  filter_var_array() Function is inbuilt function in php.This function is usesd to  gets multiple variables and optionally filters them. This function is useful for retrieving many values without repetitively calling filter_var().
Syntax
filter_var_array(array, options, add_empty)

 Parameters

value Required. Specify an array with string keys containing the data to filter.
options Optional. Specify an array of filter arguments. A valid array key is a variable name, and a valid value is a filter name or ID, or an array specifying the filter, flags and options. This parameter can also be a single filter name/ID; then all values in the input array are filtered by the specified filter. See the filter list.
add_empty Optional. If set to true, adds missing keys as null to the return value. Default is true.

GIven below example shows the usage of  filter_var_array :

Output :

Array
(
    [name] => Web Designing House   
    [age] => 25
    [email] => 
)