Open In App

PHP | stream_get_filters() Function

Last Updated : 17 Dec, 2018
Improve
Improve
Like Article
Like
Save
Share
Report

The stream_get_filters() function is an inbuilt function in PHP which is used to get the list of registered stream filters.

Syntax:

array stream_get_filters( void )

Parameters: This function does not accept any parameter.

Return Value: This function returns an array containing the name of all available stream filters.

Below programs illustrate the stream_get_filters() function in PHP:

Program 1:




<?php
  
// PHP program to illustrate
// stream_get_filter function
  
$streamlist = stream_get_filters();
print_r($streamlist);
?>


Output:

Array
(
    [0] => zlib.*
    [1] => string.rot13
    [2] => string.toupper
    [3] => string.tolower
    [4] => string.strip_tags
    [5] => convert.*
    [6] => consumed
    [7] => dechunk
    [8] => convert.iconv.*
)

Program 2: Program to print number of filters return by function.




<?php
  
// PHP program to illustrate
// stream_get_filter function
  
$res = stream_get_filters();
  
$count = sizeof($res);
  
// Print result
echo "Total Available Filters = " . $count;
?>


Output:

Total Available Filters = 9

Reference: http://php.net/manual/en/function.stream-get-filters.php


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads