Posted By

visudex on 11/22/10


email valid php check validate address verification adress

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


Validate email address PHP

 / Published in: PHP

This snippet is a PHP function that checks if an email address is valid

  1. <?php
  3. function check_email($email)
  4. {
  5. if(!filter_var($email, FILTER_VALIDATE_EMAIL))
  6. {
  7. return false;
  8. }
  9. else
  10. {
  11. return true;
  12. }
  13. }
  14. ?>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: leond on November 22, 2010

Nice! Wasn't aware of that filter_var() function yet. Thanks!

Posted By: danwhite85 on December 22, 2010

Correct me if I'm wrong, but I don't believe this works correctly. It validates [email protected]

Skipping the domain extension.

Posted By: visudex on January 23, 2011

@danwhite85 : You're right, I actually never tested without the extension.

You need to login to post a comment.