PHP get_resource_type() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report 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.Return Values: The function will return the string representing its type if the given resource is a resource. If the function does not determine the type of resource It will return Unknown. Example 1: In the following example, we will print the type of resource by using the get_resource_type() function. PHP <?php $file_text = fopen("text.txt","rb") ; echo get_resource_type($file_text) ; ?> Output: streamExample 2: In the below example, will print the Unknown when you used the get_resource_type() function without passing any resource to the function. PHP <?php $file_text = fopen("text.txt","rb") ; echo get_resource_type($file_text)."\n" ; fclose($file_text); echo get_resource_type($file_text) ; ?> Output: stream Unknown Reference: https://www.php.net/manual/en/function.get-resource-type.php Comment More infoAdvertise with us Next Article PHP get_resource_type() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Variable-handling-functions Similar Reads PHP get_resources() Function 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 parame 1 min read 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 | settype() Function The settype() function is a built-in function in PHP. The settype() function is used to the set the type of a variable. It is used to set type or modify type of an existing variable. Syntax: boolean settype($variable_name, $type) Parameters: The settype() function accepts two parameters as shown in 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 | Imagick getResource() Function The Imagick::getResource() function is an inbuilt function in PHP which is used to get the specified resource's memory usage. Syntax:  int Imagick::getResource( int $type ) Parameters: This function accepts a single parameter $type which holds an integer value corresponding to one of RESOURCETYPE 1 min read PHP | image_type_to_mime_type() Function The image_type_to_mime_type() function is an inbuilt function in PHP which is used to get the MimeType for an imagetype returned by other different functions like getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype() etc. The MIME stands for Multi-purpose Internet Mail Extensions. MIM 2 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 | ReflectionParameter getType() Function The ReflectionParameter::getType() function is an inbuilt function in PHP which is used to return the type of the specified parameter. Syntax: ReflectionType ReflectionParameter::getType ( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the type o 2 min read PHP image_type_to_extension() Function The image_type_to_extension() function is an inbuilt function in PHP which is used to get the file extension for an image type. This function can be found in any PHP version similar or greater than 5.2.0. Syntax: string image_type_to_extension( int $imagetype, bool $include_dot ) Parameters: This fu 1 min read PHP | Gmagick setimagetype() Function The Gmagick::setimagetype() function is an inbuilt function in PHP which is used to set the image type. Syntax: Gmagick Gmagick::setimagetype( int $imgType ) Parameters: This function accepts a single parameter $imgType which holds an integer value corresponding to one of the IMGTYPE constants. All 2 min read Like