PHP get_resource_type() Function

PHP gettype() Function
PHP get_defined_vars() Function

In this article, you will learn how to get the type of resource in PHP. The get_resource_type() function in PHP returns the type of a resource.

what is the syntax of the GET_RESOURCE_TYPE() function in php?

get_resource_type(resource);
ParameterDescription
resourceRequired. Specifies the resource to check
PHP GET_RESOURCE_TYPE() method

examples of the GET_RESOURCE_TYPE() function

Example 1. In this example, we get the resource type.

<?php
$file = fopen("test.txt","r");
echo get_resource_type($file);
?>
PHP gettype() Function
PHP get_defined_vars() Function

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top