Zend - The PHP Company




Email

Add Code


E-Mail validation  

Type: code fragment
Added by: russlndr
Entered: 30/11/2000
Last modified: 02/11/2008
Rating: **** (19 votes)
Views: 25508
E-Mail validation with an eregi expression.


<?php
function is_email_valid($email) {
  if(
eregi("^[a-z0-9._-]+@+[a-z0-9._-]+.+[a-z]{2,3}$"$email)) return TRUE;
  else return 
FALSE;
}
?>


Usage Example


$email = "me@zend.com";
if (is_email_valid($email)) print "E-Mail is valid";
else print "E-Mail is not valid";


Rate This Script





Search



This Category All Categories