Return to Snippet

Revision: 10456
at December 30, 2008 11:02 by Tate


Initial Code
function is_email($user_email) {
    $chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i";
    if(strstr($user_email, '@') && strstr($user_email, '.')) {
        if (preg_match($chars, $user_email)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

Initial URL


Initial Description
Wordpress function

Initial Title
Check that a variable is a valid email address

Initial Tags
validation

Initial Language
PHP