FILTER_VALIDATE_EMAILWe can check email address for validation by using FILTER_VALIDATE_EMAIL filter in PHP. Here is a sample code.
In the above code in place of FILTER_VALIDATE_EMAIL we can use filter ID as 274
Validation of Email by GET method.Whenever we receive any email address we can directly check like this ( without assigning any variable )
Inside our script before using email address we can check and assign a vaiable only if email validation is passed.
You can read how regular expressions is used to validate email address
FILTER_SANITIZE_EMAILThe id of this filter is 517. We can sanitize any variable with email address to remove unwanted chars including blank space. This function FILTER_SANITIZE_EMAIL removes all except letters, digits and {|}!#/=$%*[]+-?^_`~&'@.Here is an example
Output is here
This article is written by plus2net.com team.
![]() |
filter_list:PHP list of filters available and how to display
filter_has_var: checking the existance of variable in PHP filter_var: Validating variable using filter id FILTER_VALIDATE_FLOAT: Validating Float data FILTER_VALIDATE_INT: Validating Integer with Maximum and Minimum range FILTER_VALIDATE_REGEXP: Validating REgular Expression FILTER_VALIDATE_EMAIL: Validating Email FILTER_VALIDATE_URL: Validating URL with query string and path FILTER_VALIDATE_IP: Validating IPV4 and IPV6 address FILTER_VALIDATE_BOOLEAN: Validating boolean variable FILTER_SANITIZE_STRING: Sanitize string FILTER_SANITIZE_URL: Sanitize url |