01
08.10

PHP Email Validation

Below PHP function returns true if the email address given as parameter is valid, false otherwise.

PHP code:

function validEmail($email){
    if (preg_match("/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is", $email)){
        return true;
    }
    else{
        return false;
    }
}

Post a comment