Home >> Snippet List >> Snippet

Name
Validate email address #3
Description
This function validates an email address, returning an integer depending on whether or not the email address provided is valid A positive match will yield a result of 1, while a negative match will yield a result of 0 FALSE will be returned if an error occurred
PHP Snippet
<?PHP
 
FUNCTION isValidEmail( $email = NULL ){
     RETURN PREG_MATCH( "/^
     [\d\w\/+!=#|$?%{^&}*`'~-]
     [\d\w\/\.+!=#|$?%{^&}*`'~-]*@
     [A-Z0-9]
     [A-Z0-9.-]{1,61}
     [A-Z0-9]\.
     [A-Z]{2,6}$/ix", $email );
}
 
?>