Definition and usage
The input filter of the filter_input () function obtains scripts and filters from external sources.
This function is used to verify the source of insecure variable form, such as user input.
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)
The data filtering is successful. If the false fault or NULL is returned, the parameter "change" is not set.
Syntax
filter_input(input_type, variable, filter, options)
Parameter |
Description |
| Input_type |
Required. Specifies the input type. See the list of possible types above |
| Variable |
Required. Variable Filtering |
| Filter |
Optional. Specify the number of filters to use. The default value is FILTER_SANITIZE_STRING. Check whether PHP filters are completely possible. Refer to the filters. The filter number can be a serial number name (such as FILTER_VALIDATE_EMAIL) or an ID number (such as 274) |
| Options |
Optional. Specify the flag/option of an associated array or a single flag/option. Check various possible options and flags for each filter |
Check the instance.
For example, in this example, we use the filter_input () function to filter the variable. The variable received is a valid Email address:
Output is.
E-Mail is valid