I think that the following code will explain it:
echo (( 0 == NULL ) ? "0 is null" : "0 is not null") ."\n";
echo (0 === NULL) ? "0 is null" : "0 is not null" ;
it will output:
0 is null
0 is not null
The ===
operator checks for both value and type, but 0 is a number while NULL is of type NULL
The ==
operator checks only for value and zero can be casted to "false" or "null" hence the "truthy" that we get for the first line