is_null()

is_null() — Finds whether a variable is null.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

is_null(mixed $value): bool

Parameters

ParameterTypeWhat it takes
$valuemixedThe variable being evaluated.

Return value

Returns true if value is null, false otherwise.

Example

A runnable snippet:

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

See also

is_bool(), is_numeric(), is_float(), is_int(), is_string(), is_object(), is_array()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page is_null() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.