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);
Parameter | Description |
---|---|
resource | Required. Specifies the resource to check |
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);
?>