Skip to content

Instantly share code, notes, and snippets.

@loranger
Created February 19, 2010 14:48
Show Gist options
  • Save loranger/308757 to your computer and use it in GitHub Desktop.
Save loranger/308757 to your computer and use it in GitHub Desktop.
<?php
$url = 'http://sub.site.com/';
if( filter_var($url, FILTER_VALIDATE_URL) ){
echo 'valid uri';
}
$email = 'sub.name@gmail.com';
if( filter_var($email, FILTER_VALIDATE_EMAIL) ){
echo 'valid email';
}
// http://fr2.php.net/manual/fr/book.filter.php
// http://fr2.php.net/manual/fr/filter.examples.sanitization.php
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment