Check if a variable is NULL in PHP

Description

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

Example


<?php//w w  w .  ja  v a  2  s.  c o m

error_reporting(E_ALL);

$foo = NULL;
var_dump(is_null($inexistent), is_null($foo));

?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




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