Skip to content

Instantly share code, notes, and snippets.

@bjori
Created February 23, 2015 22:36
Show Gist options
  • Save bjori/32a8bb95b79c1ac31e65 to your computer and use it in GitHub Desktop.
Save bjori/32a8bb95b79c1ac31e65 to your computer and use it in GitHub Desktop.
ID Name Options Flags Description
-------------------------------------- ------------------------ --------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`FILTER_SANITIZE_EMAIL` "email" Remove all characters except letters, digits and `` !#$%&'*+-/=?^_`{|}~@.[] ``.
`FILTER_SANITIZE_ENCODED` "encoded" `FILTER_FLAG_STRIP_LOW`, `FILTER_FLAG_STRIP_HIGH`, `FILTER_FLAG_ENCODE_LOW`, `FILTER_FLAG_ENCODE_HIGH` URL-encode string, optionally strip or encode special characters.
`FILTER_SANITIZE_MAGIC_QUOTES` "magic\_quotes" Apply `addslashes`.
`FILTER_SANITIZE_NUMBER_FLOAT` "number\_float" `FILTER_FLAG_ALLOW_FRACTION`, `FILTER_FLAG_ALLOW_THOUSAND`, `FILTER_FLAG_ALLOW_SCIENTIFIC` Remove all characters except digits, `+-` and optionally `.,eE`.
`FILTER_SANITIZE_NUMBER_INT` "number\_int" Remove all characters except digits, plus and minus sign.
`FILTER_SANITIZE_SPECIAL_CHARS` "special\_chars" `FILTER_FLAG_STRIP_LOW`, `FILTER_FLAG_STRIP_HIGH`, `FILTER_FLAG_ENCODE_HIGH` HTML-escape `'"<>&` and characters with ASCII value less than 32, optionally strip or encode other special characters.
`FILTER_SANITIZE_FULL_SPECIAL_CHARS` "full\_special\_chars" `FILTER_FLAG_NO_ENCODE_QUOTES`, Equivalent to calling `htmlspecialchars` with `ENT_QUOTES` set. Encoding quotes can be disabled by setting `FILTER_FLAG_NO_ENCODE_QUOTES`. Like `htmlspecialchars`, this filter is aware of the [default\_charset](#ini.default-charset) and if a sequence of bytes is detected that makes up an invalid character in the current character set then the entire string is rejected resulting in a 0-length string. When using this filter as a default filter, see the warning below about setting the default flags to 0.
`FILTER_SANITIZE_STRING` "string" `FILTER_FLAG_NO_ENCODE_QUOTES`, `FILTER_FLAG_STRIP_LOW`, `FILTER_FLAG_STRIP_HIGH`, `FILTER_FLAG_ENCODE_LOW`, `FILTER_FLAG_ENCODE_HIGH`, `FILTER_FLAG_ENCODE_AMP` Strip tags, optionally strip or encode special characters.
`FILTER_SANITIZE_STRIPPED` "stripped" Alias of "string" filter.
`FILTER_SANITIZE_URL` "url" Remove all characters except letters, digits and `` $-_.+!*'(),{}|\\^~[]`<>#%";/?:@&= ``.
`FILTER_UNSAFE_RAW` "unsafe\_raw" `FILTER_FLAG_STRIP_LOW`, `FILTER_FLAG_STRIP_HIGH`, `FILTER_FLAG_ENCODE_LOW`, `FILTER_FLAG_ENCODE_HIGH`, `FILTER_FLAG_ENCODE_AMP` Do nothing, optionally strip or encode special characters. This filter is also aliased to `FILTER_DEFAULT`.
@bjori
Copy link
Author

bjori commented Feb 23, 2015

Try viewing that with textwidth 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment