Syntax:int filter_id ($filtername)
Parameters:This function takes one parameter,
$filtername, which is required. Contains the name of the filter.
Return value:Returns the filter ID on success or False if the filter does not exist.
Note. This feature is available for PHP 5.2.0 and above.Example 1:
// PHP program for getting filter ID
// Use the filter_id function to return
// filter ID
echo
(filter_id (
"validate_email"
));
?>
Exit:274
Explanation:validate_email - this is the name of the filter here. Flter_id ("validate_email") returns 274 as the filter ID of validate_email.Example 2:This example shows all the available filter names and their corresponding filter IDs provided in the filter_list ( ).
// PHP program for displaying the filter
// list with ID
foreach
(filter_list()
as
$id
= >
$filter
) {
echo
’ ’
.
$filter
.
’< / td > ’
. filter_id (
$filter
).
’< / td > ’
;
}
?>
Exit: int257boolean258 float 259validate_regexp272 validate_domain 277validate_url273validate_email 274 validate_ip275validate_mac 276 string513stripped513 encoded514special_chars515 full_special_chars 522 unsafe_raw 516 email 517 url 518 number_int 519 number_float 520 magic_quotes 521 callback 1024 Explanation:The filter_list() function returns a list of fil names trov. Using the filter_id() function, the ID of the filter name is retrieved and displayed as a component of the HTML table (for better presentation only).Links: http://php.net/manual/en/function.filter-id.php