Validating Email Addresses in PHP


Use filter_var() with FILTER_VALIDATE_EMAIL to validate email addresses.

Source Code

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