Difference between NULL and null in PHP
PhpNullPhp Problem Overview
Is there a difference between NULL
and null
in PHP? Sometimes they seem to be interchangeable and sometimes not.
edit: for some reason when I read the documentation linked to in the answer (before posting this question) I read it as "case sensitive" instead of "case insensitive" which was the whole reason I posted this question in the first place...
Php Solutions
Solution 1 - Php
Null is case insensitive.
From the documentation:
> There is only one value of type null, and that is the case-insensitive keyword NULL.
Solution 2 - Php
There is no difference. Same type just its a case insensitive keyword. Same as True
/False
etc...
Solution 3 - Php
Either will work. But the official PHP style guide, PSR-12, recommends lowercase.
https://www.php-fig.org/psr/psr-12/, Section 2.5