|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-11-23 13:36 UTC] 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 ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 18:00:01 2025 UTC |
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 )