Returns the resource type
Syntax
get_resource_type ( resource $handle ) : string
Parameters
handle
The evaluated resource handle.
Return
If the given handle is a resource, this function will return a string representing its type. If the type is not identified by this function, the return value will be the string Unknown.
This function will return NULL and generate an error if handle is not a resource.
Examples
1
<? $handle = tmpfile(); $return = get_resource_type($handle); echo $return; ?>
stream
2
<? $filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt"; $mode = "r"; $handle = fopen($filename, $mode); $return = get_resource_type($handle); echo $return; fclose($handle); ?>
stream
3
<? $filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt"; $mode = "r"; $handle = fopen($filename, $mode); fclose($handle); $return = get_resource_type($handle); echo $return; ?>
Unknown