Skip to content

Instantly share code, notes, and snippets.

@andreia
Created May 29, 2011 23:13
Show Gist options
  • Save andreia/998229 to your computer and use it in GitHub Desktop.
Save andreia/998229 to your computer and use it in GitHub Desktop.
filter_var
<?php
// http://uk.php.net/manual/en/filter.filters.php
// validate
// http://uk.php.net/manual/en/filter.filters.validate.php
$var = filter_var($email, FILTER_VALIDATE_EMAIL);
$var = filter_var($code, FILTER_VALIDATE_INT);
// sanitize
// http://uk.php.net/manual/en/filter.filters.sanitize.php
$var = filter_var($url, FILTER_SANITIZE_URL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment