Created
August 31, 2010 15:15
-
-
Save lslucas/559181 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Bad Email... | |
$badEmail = "bad@email"; | |
//Run the email through an email validation filter. | |
if( !filter_var($badEmail, FILTER_VALIDATE_EMAIL) ){ | |
echo "Email is no good."; | |
}else{ | |
echo "Nice email."; | |
} | |
//Result - Email is no good. | |
##################### | |
//Crappy email. | |
$var="bad%%@em\#ail.com"; | |
//Runs email through a sanitize filter | |
print filter_var($var, FILTER_SANITIZE_EMAIL); | |
//Result - [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment