w3resource

PHP: get_resource_type() function

Description

The get_resource_type() function returns the resource type.

Version:

(PHP 4 and above)

Syntax:

get_resource_type(file_handle)

Parameter:

Name Description Required /
Optional
Type
file_handle When a file is successfully opened by fopen() or fsockopen() it returns a resource ID, which is referred as file handler or file pointer Required Resource

Return value:

If the given file_handle is a resource, this function will return a string representing its type.

Value Type: String.

Example:


<?php
$file_hand =fopen("text.txt","w");
echo get_resource_type($file_hand);
?>

Output:

stream

Practice here online :

See also

PHP Function Reference

Previous: get_defined_vars
Next: gettype



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/get_resource_type.php