ID | Name | Options | Flags | Description |
---|---|---|---|---|
FILTER_VALIDATE_BOOLEAN |
"boolean" |
default
|
FILTER_NULL_ON_FAILURE
|
Returns
If |
FILTER_VALIDATE_EMAIL |
"validate_email" |
default
|
Validates value as e-mail. | |
FILTER_VALIDATE_FLOAT |
"float" |
default ,
decimal
|
FILTER_FLAG_ALLOW_THOUSAND
|
Validates value as float. |
FILTER_VALIDATE_INT |
"int" |
default ,
min_range ,
max_range
|
FILTER_FLAG_ALLOW_OCTAL ,
FILTER_FLAG_ALLOW_HEX
|
Validates value as integer, optionally from the specified range. |
FILTER_VALIDATE_IP |
"validate_ip" |
default
|
FILTER_FLAG_IPV4 ,
FILTER_FLAG_IPV6 ,
FILTER_FLAG_NO_PRIV_RANGE ,
FILTER_FLAG_NO_RES_RANGE
|
Validates value as IP address, optionally only IPv4 or IPv6 or not from private or reserved ranges. |
FILTER_VALIDATE_REGEXP |
"validate_regexp" |
default ,
regexp
|
Validates value against regexp , a
Perl-compatible regular expression.
|
|
FILTER_VALIDATE_URL |
"validate_url" |
default
|
FILTER_FLAG_PATH_REQUIRED ,
FILTER_FLAG_QUERY_REQUIRED
|
Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396), optionally with required components. Beware a valid URL may not specify the HTTP protocol http:// so further validation may be required to determine the URL uses an expected protocol, e.g. ssh:// or mailto: . Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail. |
Nota:
As of PHP 5.4.11, the numbers +0 and -0 validate as both integers as well as floats (using
FILTER_VALIDATE_FLOAT
andFILTER_VALIDATE_INT
). Before PHP 5.4.11 they only validated as floats (usingFILTER_VALIDATE_FLOAT
).When
default
is set to option,default
's value is used if value is not validated.