Wednesday, March 6, 2013

Check if Email is Valid using PHP

Hello Friends,

Sometimes when you need to check if email is valid or not in your code... just use this function..

function isValidEmail($email) {
    return preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email);
}

Enjoy!!

Ravi Kumar Gupta aka D'Maverick

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.