PHP Email Validation
August 20, 2007 by daynah
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:
Kindle Fire, Full Color 7" Multi-touch Display, Wi-FiMovies, apps, games, music, reading and more, plus Amazon's revolutionary cloud-accelerated web browser - 18 million movies, TV shows, songs, magazine... Read More >
Make: Electronics"This is teaching at its best!"
--Hans Camenzind, inventor of the 555 timer (the world's most successful integrated circuit), and author... Read More >
Make: Electronics (Learning by Discovery)"This is teaching at its best!"
--Hans Camenzind, inventor of the 555 timer (the world's most successful integrated circuit), and author of... Read More >
Popularity: 41% [?]


@






