PHP | filter_id() Function Last Updated : 29 Dec, 2022 Comments Improve Suggest changes Like Article Like Report The filter_id() function is an inbuilt function in PHP which returns the filter ID of a specified filter name. It is used to get the filter id of the particular filter in PHP by using filter_id function by giving the name of the filter as input and get the associated id to it. Syntax: int filter_id( $filtername ) Parameters: This function accepts single parameter $filtername which is mandatory. It holds the filter name. Return Value: It returns the ID of the filter on success or False if filter doesn't exist. Note: This function available for PHP 5.2.0 and newer versions. Example 1: php <?php // PHP program to get the filter ID // Use filter_id function to return // the filter id echo(filter_id("validate_email")); ?> Output:274 Explanation: validate_email is name of the filter here. The filter_id ("validate_email") returns 274 as ID of the filter validate_email. Example 2: This example shows all the available filter name and it's corresponding filter id represented in filter_list() function. php <?php // PHP program to display the filter // list with ID foreach (filter_list() as $id =>$filter) { echo '<tr><td>' . $filter . '</td><td>' . filter_id($filter) . '</td></tr>'; } ?> Output:int257boolean258float259validate_regexp272validate_domain277validate_url273validate_email274validate_ip275validate_mac276string513stripped513encoded514special_chars515full_special_chars522unsafe_raw516email517url518number_int519number_float520magic_quotes521callback1024 Explanation: The filter_list() function returning list of filter name. Using filter_id() function id of the filter name is extracted and given output as HTML table component (to represent in better way only). References: http://php.net/manual/en/function.filter-id.php Comment More infoAdvertise with us Next Article PHP | filter_id() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | filter_list() Function The filter_list() function is an inbuilt function in PHP which is used to returns the list of all supported filters. Syntax: array filter_list( void ) Parameters: This function does not accepts any parameters. Return Values: It returns an array containing all names of supported filters. If it return 2 min read PHP | filter_input() Function The filter_input() is an inbuilt function in PHP which is used to get the specific external variable by name and filter it. This function is used to validate variables from insecure sources, such as user input from form. This function is very much useful to prevent some potential security threat lik 2 min read PHP | Imagick filter() Function The Imagick::filter() function is an inbuilt function in PHP which is used to apply custom convolution kernel to the image. A kernel, convolution matrix, or mask is a small matrix. It is used for blur, sharpen, embossing, edge detection, and many more. Syntax: bool Imagick::filter( $ImagickKernel, $ 1 min read PHP | preg_filter() Function The preg_filter() function is an inbuilt function in PHP which is used to perform a regular expression search and replace the text. Syntax: preg_filter( $pattern, $replacement, $subject, $limit, $count ) Parameters: This function accepts five parameters as mention above and describe below. $pattern: 2 min read PHP | filter_has_var() function The filter_has_var() function is an inbuilt function in PHP which is used to check whether the variable available or not especially it checks if a variable of a specified input type exist or not. It returns True on success or False on failure. Syntax: bool filter_has_var( $type, $variable_name ) Par 2 min read Like