NYCPHP Meetup

NYPHP.org

[nycphp-talk] validating email address

Rob Marscher rmarscher at beaffinitive.com
Fri Dec 14 12:44:13 EST 2007


On Dec 14, 2007, at 10:55 AM, selyah wrote:
> I am stuck on validating the email address.

Check this out.  PHP 5 now includes the filter extension by default.   
Saves you from having to keep your regular expression up to date --  
just keep your php install up to date instead:

if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false) {
	// email passed validation
} else {
	// email is not valid
}

http://php.net/filter
http://php.net/filter_var

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071214/2bd5aa66/attachment.html>


More information about the talk mailing list