Definition and usage
The filter_input_array () function gets multiple filters from external input scripts and filters them.
This function is useful for filtering a large number of input variables without requiring filter_input (), many.
You can enter several sources for this feature:
INPUT_GET
INPUT_POST
INPUT_COOKIE
INPUT_ENV
INPUT_SERVER
INPUT_SESSION (not implemented yet)
INPUT_REQUEST (not implemented yet)
Returns an array of successfully filtered data, which is false.
Syntax
filter_input(input_type, args)
Input_type: required. Specifies the input type. See the list of possible types (args): Optional. Specifies the arguments for a series of filters.
The key to a series of valid values is a variable name and a valid value. It is a filter ID or an array that specifies the filter, flag, and selection. This parameter can also be a single filter number. If so, all values in the input array filter the specified filter number can be a number name (such as FILTER_VALIDATE_EMAIL) or ID Number (such as 274)
Tips and instructions: Check the PHP filter for reference filters.
For example, in this example, we use the filter_input_array () function to filter the last three variables.
The variable after receiving the message is a name, age and e-mail address:
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_input_array(INPUT_POST, $filters));?>
Return Value diligence.
Array ( [name] => Peter [age] => 41 [email] => peter@example.com )