PHP 8.3.4 Released!

Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

INPUT_POST (int)
POST variables.
INPUT_GET (int)
GET variables.
COOKIE variables.
INPUT_ENV (int)
ENV variables.
INPUT_SERVER (int)
SERVER variables.
INPUT_SESSION (int)
SESSION variables. (not implemented yet)
INPUT_REQUEST (int)
REQUEST variables. (not implemented yet)
FILTER_FLAG_NONE (int)
No flags.
FILTER_REQUIRE_SCALAR (int)
Flag used to require scalar as input
FILTER_REQUIRE_ARRAY (int)
Require an array as input.
FILTER_FORCE_ARRAY (int)
Always returns an array.
FILTER_NULL_ON_FAILURE (int)
Use NULL instead of FALSE on failure.
FILTER_VALIDATE_INT (int)
ID of "int" filter.
FILTER_VALIDATE_BOOL (int)
Alias of FILTER_VALIDATE_BOOLEAN.
FILTER_VALIDATE_BOOLEAN (int)
ID of "boolean" filter.
FILTER_VALIDATE_FLOAT (int)
ID of "float" filter.
FILTER_VALIDATE_REGEXP (int)
ID of "validate_regexp" filter.
FILTER_VALIDATE_URL (int)
ID of "validate_url" filter.
FILTER_VALIDATE_DOMAIN (int)
ID of "validate_domain" filter. (Available as of PHP 7.0.0)
FILTER_VALIDATE_EMAIL (int)
ID of "validate_email" filter.
FILTER_VALIDATE_IP (int)
ID of "validate_ip" filter.
FILTER_VALIDATE_MAC (int)
ID of "validate_mac_address" filter.
FILTER_DEFAULT (int)
ID of default ("unsafe_raw") filter. This is equivalent to FILTER_UNSAFE_RAW.
FILTER_UNSAFE_RAW (int)
ID of "unsafe_raw" filter.
FILTER_SANITIZE_STRING (int)
ID of "string" filter. (Deprecated as of PHP 8.1.0, use htmlspecialchars() instead.)
FILTER_SANITIZE_STRIPPED (int)
ID of "stripped" filter. (Deprecated as of PHP 8.1.0, use htmlspecialchars() instead.)
FILTER_SANITIZE_ENCODED (int)
ID of "encoded" filter.
FILTER_SANITIZE_SPECIAL_CHARS (int)
ID of "special_chars" filter.
FILTER_SANITIZE_EMAIL (int)
ID of "email" filter.
FILTER_SANITIZE_URL (int)
ID of "url" filter.
FILTER_SANITIZE_NUMBER_INT (int)
ID of "number_int" filter.
FILTER_SANITIZE_NUMBER_FLOAT (int)
ID of "number_float" filter.
FILTER_SANITIZE_MAGIC_QUOTES (int)
ID of "magic_quotes" filter. (DEPRECATED as of PHP 7.3.0 and REMOVED as of PHP 8.0.0, use FILTER_SANITIZE_ADD_SLASHES instead.)
FILTER_SANITIZE_ADD_SLASHES (int)
ID of "add_slashes" filter. (Available as of PHP 7.3.0)
FILTER_CALLBACK (int)
ID of "callback" filter.
FILTER_FLAG_ALLOW_OCTAL (int)
Allow octal notation (0[0-7]+) in "int" filter.
FILTER_FLAG_ALLOW_HEX (int)
Allow hex notation (0x[0-9a-fA-F]+) in "int" filter.
FILTER_FLAG_STRIP_LOW (int)
Strip characters with ASCII value less than 32.
FILTER_FLAG_STRIP_HIGH (int)
Strip characters with ASCII value greater than 127.
FILTER_FLAG_STRIP_BACKTICK (int)
Strips backtick characters.
FILTER_FLAG_ENCODE_LOW (int)
Encode characters with ASCII value less than 32.
FILTER_FLAG_ENCODE_HIGH (int)
Encode characters with ASCII value greater than 127.
FILTER_FLAG_ENCODE_AMP (int)
Encode &.
FILTER_FLAG_NO_ENCODE_QUOTES (int)
Don't encode ' and ".
FILTER_FLAG_EMPTY_STRING_NULL (int)
(No use for now.)
FILTER_FLAG_ALLOW_FRACTION (int)
Allow fractional part in "number_float" filter.
FILTER_FLAG_ALLOW_THOUSAND (int)
Allow thousand separator (,) in "number_float" filter.
FILTER_FLAG_ALLOW_SCIENTIFIC (int)
Allow scientific notation (e, E) in "number_float" filter.
FILTER_FLAG_PATH_REQUIRED (int)
Require path in "validate_url" filter.
FILTER_FLAG_QUERY_REQUIRED (int)
Require query in "validate_url" filter.
FILTER_FLAG_SCHEME_REQUIRED (int)
Require scheme in "validate_url" filter. (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied in the filter already.)
FILTER_FLAG_HOST_REQUIRED (int)
Require host in "validate_url" filter. (Deprecated as of PHP 7.3.0 and removed as of PHP 8.0.0, as it is implied in the filter already.)
FILTER_FLAG_HOSTNAME (int)
Require hostnames to start with an alphanumeric character and contain only alphanumerics or hyphens. (Available as of PHP 7.0.0)
FILTER_FLAG_IPV4 (int)
Allow only IPv4 address in "validate_ip" filter.
FILTER_FLAG_IPV6 (int)
Allow only IPv6 address in "validate_ip" filter.
FILTER_FLAG_NO_RES_RANGE (int)
Deny reserved addresses in "validate_ip" filter.
FILTER_FLAG_NO_PRIV_RANGE (int)
Deny private addresses in "validate_ip" filter.
FILTER_FLAG_EMAIL_UNICODE (int)
Accepts Unicode characters in the local part in "validate_email" filter. (Available as of PHP 7.1.0)
add a note

User Contributed Notes 3 notes

up
11
shaman_master at list dot ru
3 years ago
Note: FILTER_NULL_ON_FAILURE, FILTER_REQUIRE_SCALAR, FILTER_REQUIRE_ARRAY and FILTER_FORCE_ARRAY dont have prefix "FILTER_FLAG_" but they are FLAGS!
up
0
jcastromail at yahoo dot es
3 years ago
INPUT_REQUEST was implemented in PHP < 8 (it was equal to 99) but it was removed in PHP 8.0

While INPUT_SESSION,FILTER_SANITIZE_MAGIC_QUOTES,FILTER_FLAG_SCHEME_REQUIRED,FILTER_FLAG_HOST_REQUIRED and a few others were removed in PHP 8.0.
up
-30
sixd at php dot net
13 years ago
Rasmus added FILTER_SANITIZE_FULL_SPECIAL_CHARS to PHP 5.3.3. See
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/
ext/filter/filter.c?r1=297245&r2=297244&pathrev=297245
His earlier commit to the PHP source code trunk commented that this "Added the full htmlspecialchars() functionality which includes utf-8 validation as a default filter."
To Top