Doc #60365 [Opn]: filter options
| From: | php at farawa dot de | Date: | Wed, 23 Nov 2011 13:45:36 +0000 |
| Subject: | Doc #60365 [Opn]: filter options | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7460@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60365&edit=1
ID: 60365
User updated by: php at farawa dot de
Reported by: php at farawa dot de
Summary: filter options
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
a coleuge gave me the tip to use the function filter_list() to get the possible call back options,
but these are also others then used in your example, but in anyway the seams to be shorter and
better for memoriziations...
<?php
print('<pre>');
print_r( filter_list() );
print('<pre>');
?>
example output:
Array
(
[0] => int
[1] => boolean
[2] => float
[3] => validate_regexp
[4] => validate_url
[5] => validate_email
[6] => validate_ip
[7] => string
[8] => stripped
[9] => encoded
[10] => special_chars
[11] => unsafe_raw
[12] => email
[13] => url
[14] => number_int
[15] => number_float
[16] => magic_quotes
[17] => callback
)
Previous Comments:
------------------------------------------------------------------------
[2011-11-23 13:36:50] php at farawa dot de
Description:
------------
i'm missing an example to get the native filter callback options...
would be great if you can enter them in the examples for the filter_ functions.
may they are some more that i missed within the test script?
valentin
---
From manual page: http://www.php.net/function.filter-var#refsect1-function.filter-var-examples
---
Test script:
---------------
<?php
print('<pre>');
$f = get_defined_constants('FILTER');
print_r( $f['filter'] );
print('</pre>');
?>
possible output:
Array
(
[INPUT_POST] => 0
[INPUT_GET] => 1
[INPUT_COOKIE] => 2
[INPUT_ENV] => 4
[INPUT_SERVER] => 5
[INPUT_SESSION] => 6
[INPUT_REQUEST] => 99
[FILTER_FLAG_NONE] => 0
[FILTER_REQUIRE_SCALAR] => 33554432
[FILTER_REQUIRE_ARRAY] => 16777216
[FILTER_FORCE_ARRAY] => 67108864
[FILTER_NULL_ON_FAILURE] => 134217728
[FILTER_VALIDATE_INT] => 257
[FILTER_VALIDATE_BOOLEAN] => 258
[FILTER_VALIDATE_FLOAT] => 259
[FILTER_VALIDATE_REGEXP] => 272
[FILTER_VALIDATE_URL] => 273
[FILTER_VALIDATE_EMAIL] => 274
[FILTER_VALIDATE_IP] => 275
[FILTER_DEFAULT] => 516
[FILTER_UNSAFE_RAW] => 516
[FILTER_SANITIZE_STRING] => 513
[FILTER_SANITIZE_STRIPPED] => 513
[FILTER_SANITIZE_ENCODED] => 514
[FILTER_SANITIZE_SPECIAL_CHARS] => 515
[FILTER_SANITIZE_EMAIL] => 517
[FILTER_SANITIZE_URL] => 518
[FILTER_SANITIZE_NUMBER_INT] => 519
[FILTER_SANITIZE_NUMBER_FLOAT] => 520
[FILTER_SANITIZE_MAGIC_QUOTES] => 521
[FILTER_CALLBACK] => 1024
[FILTER_FLAG_ALLOW_OCTAL] => 1
[FILTER_FLAG_ALLOW_HEX] => 2
[FILTER_FLAG_STRIP_LOW] => 4
[FILTER_FLAG_STRIP_HIGH] => 8
[FILTER_FLAG_ENCODE_LOW] => 16
[FILTER_FLAG_ENCODE_HIGH] => 32
[FILTER_FLAG_ENCODE_AMP] => 64
[FILTER_FLAG_NO_ENCODE_QUOTES] => 128
[FILTER_FLAG_EMPTY_STRING_NULL] => 256
[FILTER_FLAG_ALLOW_FRACTION] => 4096
[FILTER_FLAG_ALLOW_THOUSAND] => 8192
[FILTER_FLAG_ALLOW_SCIENTIFIC] => 16384
[FILTER_FLAG_SCHEME_REQUIRED] => 65536
[FILTER_FLAG_HOST_REQUIRED] => 131072
[FILTER_FLAG_PATH_REQUIRED] => 262144
[FILTER_FLAG_QUERY_REQUIRED] => 524288
[FILTER_FLAG_IPV4] => 1048576
[FILTER_FLAG_IPV6] => 2097152
[FILTER_FLAG_NO_RES_RANGE] => 4194304
[FILTER_FLAG_NO_PRIV_RANGE] => 8388608
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60365&edit=1