PHP get_resource_type() Function
❮ PHP Variable Handling Reference
Example
Return the resource type:
<?php
$file = fopen("test.txt","r");
echo get_resource_type($file);
?>
Run Example »
Definition and Usage
The get_resource_type() function returns the type of a resource.
Syntax
get_resource_type(resource);
Parameter Values
Parameter | Description |
---|---|
resource | Required. Specifies the resource to check |
Technical Details
Return Value: | The type as a string on success, if type is not identified it returns "unknown", if resource is not a resource it returns NULL and generates an error |
---|---|
Return Type: | String |
PHP Version: | 4.0.2+ |
PHP Changelog: | PHP 5.3: If resource is not a resource it returns NULL. Earlier, the returned value was FALSE |
❮ PHP Variable Handling Reference