Definition and usage
The filter of the filter_var () function and the filter specified by a variable.
A success or a failure of FALSE is returned.
Syntax
Filter_var (variable, filter, options)
Variable: required. 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 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
Let's take a look at the filter_var instance tutorial.
If (! Filter_var ("someone @ example....com", FILTER_VALIDATE_EMAIL) {echo ("E-mail is not valid ");} else {echo ("E-mail is valid") ;}?>
Output result.
Email is not valid