Below code shows validation of Email address use FILTER_VALIDATE_EMAIL flag
FILTER_VALIDATE_EMAIL - Confirms whether the value is a valid email address. Generally, this verifies email addresses against syntax in RFC 822, except that whitespace comments and anonymous domain names are not supported.
Example
<?php
$email = "testmail@mail.com";
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid format and please re-enter valid email";
}
?>
Above the syntax will verify whether the given email address is correct or not. If not, it will show an error message.