Easy Tutorial
❮ Func Date Default Timezone Set Func Mysqli Set Charset ❯

PHP filter_var() Function



Definition and Usage

The filter_var() function filters a variable with a specified filter.

Syntax

Parameter Description
variable Required. Specifies the variable to filter.
filter Optional. Specifies the ID of the filter to use. The default is FILTER_SANITIZE_STRING. See Complete PHP Filter Reference. The filter ID can be an ID name (e.g., FILTER_VALIDATE_EMAIL) or an ID number (e.g., 274).
options Optional. Specifies an associative array containing flags/options or a single flag/option. Check each filter for possible flags and options.

Example

The output of the code is as follows:


❮ Func Date Default Timezone Set Func Mysqli Set Charset ❯