Easy Tutorial
❮ Func Xml Parser Set Option Func Math Min ❯

PHP filter_input_array() Function



Definition and Usage

The filter_input_array() function retrieves multiple inputs from outside the script (such as form inputs) and filters them.

This function is useful for filtering multiple input variables without repeatedly calling filter_input().

The function can retrieve input from various sources:

If successful, it returns the filtered data as an array. If it fails, it returns FALSE.

Syntax

Parameter Description
input_type Required. Specifies the input type. See the list above for possible types.
filter_args Optional. Specifies an array of filter parameters. Valid array keys are variable names, and valid values are filter IDs, or arrays that specify the filter, flags, and options. This parameter can also be a single filter ID, in which case all values in the input array are filtered by the specified filter. Filter IDs can be either the ID name (e.g., FILTER_VALIDATE_EMAIL) or the ID number (e.g., 274).

Tips and Notes

Tip: See the Complete PHP Filter Reference Manual for filters that can be used with this function.


Example

In this example, we use the filter_input_array() function to filter three POST variables. The POST variables received are the name, age, and email address:

The output of the code is as follows:


❮ Func Xml Parser Set Option Func Math Min ❯