/ Published in: PHP
This snippet is a PHP function that checks if an email address is valid
Expand |
Embed | Plain Text
<?php function check_email($email) { if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { return false; } else { return true; } } ?>
Comments
Subscribe to comments
You need to login to post a comment.

Nice! Wasn't aware of that filter_var() function yet. Thanks!
Correct me if I'm wrong, but I don't believe this works correctly. It validates name@domain
Skipping the domain extension.
@danwhite85 : You're right, I actually never tested without the extension.