Validation

Check if an email address is valid in PHP

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

In order to validate an email address the FILTER_VALIDATE_EMAIL filter must be used. It's part of the PHP validation filters group. You can see more filters here: https://www.php.net/manual/en/filter.filters.validate.php

In general, this validates e-mail addresses against the addr-specsyntax in » RFC 822, with the exceptions that comments and whitespace folding and dotless domain names are not supported.