PHP filter_input() Function

The filter_input() function gets an external variable (e.g. from form input) and optionally filters it.This function is used to validate variables from insecure sources, such as user input.Check if the external variable "email" is sent to the PHP page, through the "get" method,filter_input — Gets a specific external variable by name and optionally filters it.

mixed filter_input ( int $type , string $variable_name [, int $filter = FILTER_DEFAULT [, mixed $options ]] )

Example -

ParameterDescription
typeOne of INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV
variable_nameName of a variable to get
filterIf omitted, FILTER_DEFAULT will be used, which is equivalent to FILTER_UNSAFE_RAW. This will result in no filtering taking place by default
optionsAssociative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array