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.
Now we will modify it by displaying in a formatted output.We used standard array display techniques 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_list not the filter ID number )
WE can get the filter id of the particular filter in PHP by using filter_id function. We will input the name of the filter and get the associated id of it. The list containing name of filter is available at filter_list page. Here is the syntax.
Int filter_id(filter name)
Here is one example
echo filter_id('validate_url');
The output of above line is here
273
We can also display the associated id of all the filters in a single list. Here is the sample code.
$ar=filter_list();
while (list ($key, $val) = each ($ar)) {
echo "$key -> $val : ( ".filter_id($val). " ) <br>";
}