= 4.0.2, PHP 5, PHP 7 Syntax string get_resource_type ( resource" />



English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP get_resource_type() Function Usage and Example

PHP Available Functions

get_resource_type() Returns the type of the resource (resource).

Version Required: PHP 4 >= 4.0.2, PHP 5, PHP 7

Syntax

string get_resource_type ( resource $handle )

Parameter Description:

  • $handle: handle.

Return Value

This function returns a string representing the type of the resource passed to it. An error will occur if the parameter is not a valid resource.

Online Example

<?php
$c = mysql_connect();
echo get_resource_type($c) . PHP_EOL;
// Print: mysql link
$fp = fopen("foo","w");
echo get_resource_type($fp) . PHP_EOL;
// Print: file
$doc = new_xmldoc("1.0");
echo get_resource_type($doc->doc) . PHP_EOL;
// Print: domxml document
?>

PHP Available Functions