Is there any difference between NULL
(written in upper case) and null
(written in lowercase) in PHP?
I know I can use both types, but is there any naming rule for these words?
Is there any difference between NULL
(written in upper case) and null
(written in lowercase) in PHP?
I know I can use both types, but is there any naming rule for these words?
Under lines , there are no differences. NULL is case insensitive - not case-sensitive. In the documentation this is said:
There is only one null value, and this is the constant case insensitive NULL.
The same goes for TRUE and FALSE . As also said in documentation , both are case insensitive :
To specify a literal Boolean, use the TRUE or FALSE constants. Both are case insensitive .
So you can use which one is more convenient, or which you have more familiarity with.
PSR's comments on this. Although they are just a style guide and not rules to enforce, they recommend that:
PHP keywords must be in lowercase . PHP , false and null constants should be written in lowercase .
We also have a question answered about this in our Big Brother SO .