<html>
<body>
// Variable to check
$email = "john.doe@example.com";
// Remove all illegal characters from email
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate e-mail
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo("$email is a valid email address");
} else {
echo("$email is not a valid email address");
}
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_func_validate_email2 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 18:10:00 GMT -->
</html>