The filter_var() function filters a variable with the specified filter.filter_var — Filters a variable with a specified filter.Returns the filtered data, or FALSE if the filter fails.
mixed filter_var ( mixed $variable [, int $filter = FILTER_DEFAULT [, mixed $options ]] )
The above example will output : -
string(15) "bob@example.com" bool(false)
Parameter | Description |
---|---|
variable | Value to filter. Note that scalar values are converted to string internally before they are filtered. |
filtername | Optional. Specifies the ID or name of the filter to use. Default is FILTER_DEFAULT, which results in no filtering |
options | Optional. Specifies one or more flags/options to use. Check each filter for possible options and flags |