PHPFront

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



Validate an Email


Authormkeefe
DescriptionChecks the validity of an email passed to it.
RatingThis script has been rated 5/5 (6 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