Posted By

sveggiani on 01/05/09


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

will_00
umang_nine
pezland
BrianCoyDesign


evValidEmail | checks if a given string is a valid e-mail address


 / Published in: PHP
 

only checks if the string contains @, . and alphanumeric characters

  1. // name: evValidEmail
  2. // version: v0.1
  3. // description: chequea que sea un email valido
  4.  
  5. function evValidEmail( $email ) {
  6.  
  7. if ( !eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email ) ) : return true;
  8. else: return false;
  9. endif;
  10.  
  11. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Scooter on January 8, 2009

There are valid top-level domains longer than 3 characters.

Posted By: sveggiani on February 19, 2009

You are right Scooter. This is an unsafe & old function so use it carefully.

Thanks for the comment.

You need to login to post a comment.