Monday 2 February 2015

filter_list in PHP

filter_list

We can display list of available filters by using filter_list function. This function returns an array with list of available filters as elements. Here is the example.

print_r(filter_list());

The output is here
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] => full_special_chars [12] => unsafe_raw [13] => email
 [14] => url [15] => number_int
 [16] => number_float [17] => magic_quotes [18] => callback )
Now we will modify it by displaying in a formatted output.We used standard array displaytechniques to display the elements of the array
Here is the code to display output
$ar=filter_list();
while (list ($key, $val) = each ($ar)) {
echo "$key -> $val <br>";
} 
The output is here ( Note that the serial number is the key number of the array filter_listnot the filter ID number )
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 -> full_special_chars 
12 -> unsafe_raw 
13 -> email 
14 -> url 
15 -> number_int 
16 -> number_float 
17 -> magic_quotes 
18 -> callback 

0 comments:

Post a Comment