The PHP website created by its users!
Home
»
PHP » Validate an Email
|
Validate an Email
| Author | mkeefe |
| Description | Checks the validity of an email passed to it. |
| Rating | (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;
}
}
?>
Comments
nice custom function
|