null Does Not Always Equal false¶
<?php
var_dump(null == false);
print_r([null => 1,
false => 1,
]);
?>
null equals false, so the first equality is actually true.
On the other hand, using null and false as keys in an array, lead them to be cast to string: they end up being different, and that allows two elements to be stored in the array.
See Also¶
null and false are in an array [Try me]
PHP Features¶
Last updated: 14 July 2026