Easy Tutorial
❮ Func Array Each Func Array Keys ❯

PHP is_null() Function

Available PHP Functions

The is_null() function is used to check if a variable is NULL.

PHP Version Requirements: PHP 4 >= 4.0.4, PHP 5, PHP 7

Syntax

bool is_null ( mixed $var )

Parameter Description:

Return Value

Returns TRUE if the specified variable is NULL, otherwise returns FALSE.

Example

<?php
$var_name = TRUE;
$var_name2 = NULL;

if (is_null($var_name))
{
    echo 'Variable var_name is NULL' . PHP_EOL;
}
else
{
    echo 'Variable var_name is not NULL' . PHP_EOL;
}

if (is_null($var_name2))
{
    echo 'Variable var_name2 is NULL' . PHP_EOL;
}
else
{
    echo 'Variable var_name2 is not NULL' . PHP_EOL;
}
?>

Output:

Variable var_name is not NULL
Variable var_name2 is NULL

Available PHP Functions

❮ Func Array Each Func Array Keys ❯