PHP Front
The PHP website created by its users!
Home » PHP » Validate an Email


Validate an Email


Authormkeefe
DescriptionChecks the validity of an email passed to it.
RatingThis script has been rated 4/5 (10 votes)

PHP Code


<?php

/***********************************************************************
* Use:
* (validEmail($email) ? print "valid!" : print "Invalid";             
***********************************************************************/
function validEmail($email
    {
    if (
eregi("[a-z0-9]+([-_.]?[a-z0-9])+@[a-z0-9]+([-_.]?[a-z0-9])+.[a-z]{2,4}"$email)) 
        {
        return 
true;
        }
    else 
        {
        return 
false;
        }
    }
?>



Rate it: Print Print

Comments


jumbosheep / 20 Dec 05

nice custom function
Name
Website
Your comment