The is_null() function is used to determine whether a variable is NULL. It returns true if the variable is NULL, and false otherwise.

Example:

<?php $var = null;

if (is_null($var)) {
    echo "Variable is NULL\n";
} else {
    echo "Variable is not NULL\n";
}

Output:

Variable is NULL

In this example:

  • The variable $var is assigned null.
  • The is_null() function checks whether $var is NULL.
  • Since $var is null, the function returns true, and the message "Variable is NULL" is echoed.