Checking if an Email is Valid in PHP


Validate an email address with filter_var() and the FILTER_VALIDATE_EMAIL flag.

Source Code

$email = "[email protected]";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    echo "This is a valid email address.";
} else {
    echo "Invalid email address.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments