Created
January 15, 2018 14:49
-
-
Save InFog/e3bcd7f0122744e00fddf5040eaa11e1 to your computer and use it in GitHub Desktop.
Filter email in PHP
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 | |
$validInput = "[email protected]"; | |
$invalidInput = "\"'/><script>alert(1)</script>"; | |
echo "Valid: "; | |
echo filter_var($validInput, FILTER_VALIDATE_EMAIL); | |
echo PHP_EOL; | |
echo "Invalid: "; | |
echo filter_var($invalidInput, FILTER_VALIDATE_EMAIL); | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment