PHP Email Validation

August 20, 2007 by  
Filed under Code Snippets

Note to self, use this for email validation:

function isEmail($email)
{
if(ereg("^([a-zA-Z0-9_\-\.]+)@
((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|
(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email))
return 1; // If email address is valid
else
return 0;
}

Minus all the spaces in the ereg function.

Related Products:

HORI Nintendo Switch Split Pad Pro (Daemon X Machina Edition) Ergonomic Controller for Handheld Mode - Officially Licensed By Nintendo - Nintendo SwitchHORI Nintendo Switch Split Pad Pro (Daemon X Machina Edition) Ergonomic Controller for Handheld Mode - Officially Licensed By Nintendo - Nintendo SwitchA revolutionary way to play your Nintendo Switch! Enjoy the full-size controller experience in handheld mode with the HORI Split Pad Pro. Featuring fu... Read More >
Related Posts Plugin for WordPress, Blogger...