-
-
Save GabeStah/4985e41fa7ad86a62f20 to your computer and use it in GitHub Desktop.
Coding Dojo - PHP Best Practices - Simple Validation
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 | |
// Returns 'john.doe@gmail.com', a valid email. | |
echo filter_var("john.doe@gmail.com", FILTER_VALIDATE_EMAIL), '<br/>'; | |
// Return 'http://www.codingdojo.com/', a valid URL. | |
echo filter_var("http://www.codingdojo.com/", FILTER_VALIDATE_URL), '<br/>'; | |
// Return '192.168.0.0', a valid IP. | |
echo filter_var("192.168.0.0", FILTER_VALIDATE_IP), '<br/>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment