PHP is_null() and ==null

So you can understand it better:

$a = null;
$b = 0;

is_null($a) // TRUE
$a == null  // TRUE
$a === null // TRUE
is_null($b) // FALSE
$b == null  // TRUE
$b === null // FALSE

There are a couple really good charts on the php.net site that show how different values react:

Type Comparison - php.net


You can check the comparison between is_null() and null === $var

Good comparison between two


is_null is the same as === null. Both return true when a variable is null (or unset).

Note that I'm using === and not ==. === compares type as well as value.

Tags:

Php

Null