get_resource_type

string gettype(resource resource) 

Finds the type of a resource.

Returns:

String containing the resource type name; FALSE on error

Description:

get_resource_type() returns the specific type of a resource. Resources are abstract datatypes representing a handle to a particular system resource, such as file/stream pointers, database connections, and so forth.

If the resource type is not known, Unknown is returned. If the value passed is not a resource, the function will generate a warning and return FALSE.

Version:

PHP 4.0.2+

Example:

Find the type for a variety of resources
 <?php echo get_resource_type (mysql_connect ()), "\n", get_resource_type (mysql_query ("SELECT now()")), "\n", get_resource_type (fopen (__FILE__, 'r')), ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.