filter_id() function in PHP


The filter_id() function returns the filter ID of provided filter name.

Syntax

filter_id(filtername)

Parameters

  • filtername − The name of filter to get the ID from.

Return

The filter_id() function returns filter ID on success or FALSE, if the filter does not exist.

Example

<?php
   foreach (filter_list() as $id =>$filter) {
      echo $filter . "=" . filter_id($filter) . "<br>";
   }
?>

Output

The following is the output.

int = 257
boolean = 258
float = 259
validate_regexp = 272
validate_domain = 277
validate_url = 273
validate_email = 274
validate_ip = 275
validate_mac = 276
string = 513
stripped = 513
encoded = 514
special_chars = 515
full_special_chars = 522
unsafe_raw = 516
email = 517
url = 518number_int = 519
number_float = 520
magic_quotes = 521
callback = 1024

Updated on: 27-Dec-2019

200 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements