Check if a variable is a resource in PHP

Description

The following code shows how to check if a variable is a resource.

Example


<?php/*  w  w w .  j a  va 2s . co m*/

$db_link = @mysql_connect('localhost', 'mysql_user', 'mysql_pass');
if (!is_resource($db_link)) {
    die('Can\'t connect : ' . mysql_error());
}

?>




















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition