PHP get_resources() Function Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The get_resources() function is an inbuilt function in PHP that returns active resources in an array form, & optionally, the resource type will be filtered. Syntax: array get_resources(?string $type = null)Parameters: This function accepts one parameter that is described below: type: This parameter will restrict the function to return only the resources for the given type if defined. If the string is unknown, it will return unknown resources. It will return all resources if this is omitted.Return Value: This function returns current resources in an array form, indexed by resource number. Example 1: In the below code, we will return specific resources using the get_resources() function. PHP <?php var_dump(get_resources('stream')) ; ?> Output: array(3) { [1]=> resource(1) of type (stream) [2]=> resource(2) of type (stream) [3]=> resource(3) of type (stream) } Example 2: This is another example that demonstrates the get_resources() function. PHP <?php $fp = tmpfile(); var_dump(get_resources()); ?> Output: array(4) { [1]=> resource(1) of type (stream) [2]=> resource(2) of type (stream) [3]=> resource(3) of type (stream) [4]=> resource(4) of type (stream) } Reference: https://www.php.net/manual/en/function.get-resources.php Comment More infoAdvertise with us Next Article PHP | parse_url() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Options-info Similar Reads PHP get_resource_id() Function The get_resource_id() function is an inbuilt function in PHP that returns the integer id given resource. This function provides a safe way of generating integers for a resource. Syntax: get_resource_id($resource) ;Parameters: This function accepts one parameter that are described below: $resource: 1 min read PHP get_resource_type() Function The get_resource_type() function is an inbuilt function in PHP that is used for returning the type of resource. Syntax: get_resource_type(resource $resource) Parameters: This function accepts one parameter that described below: $resource: This parameter specifies the evaluated resource handle name.R 1 min read PHP | show_source() Function The show_source() function is an inbuilt function in PHP which is used to return a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags. Syntax: show_source( $filename, $return ) Parameters: This function accepts two parameters as mentioned above and described below: $f 2 min read PHP | Imagick setResourceLimit() Function The Imagick::setResourceLimit() function is an inbuilt function in PHP which is used to set the limit for a particular resource. Syntax: int Imagick::setResourceLimit( int $type, int $limit ) Parameters: This function accepts two parameters as mentioned above and described below: $type: It specifies 1 min read PHP | parse_url() Function The parse_url() function is an inbuilt function in PHP which is used to return the components of a URL by parsing it. It parses an URL and return an associative array which contains its various components. Syntax: parse_url( $url, $component = -1 ) Parameters: This function accepts two parameters as 2 min read PHP | readdir() Function The readdir() function in PHP is an inbuilt function which is used to return the name of the next entry in a directory. The method returns the filenames in the order as they are stored in the filenamesystem. The directory handle is sent as a parameter to the readdir() function and it returns the ent 2 min read Like