I noticed that some PHP frameworks use exclusively lowercase true
/false
and others upper.
Does it make any difference at all? I for one prefer lowercase.
FALSE is not defined in the standard. Only false is. true and false are called "Boolean literals", and are keywords in C++. FALSE is sometimes defined as a macro.
If the left side of the expression is "falsey", the expression will return the left side. If the left side of the expression is "truthy", the expression will return the right side. That's it. So in false && false , the left side is "falsey", so the expression returns the left side, false .
In Math a = b = c mean all a = b , b = c and a = c . So True is False == False means True == False and False == False and True == False , which is False . For boolean constants, is is equivalent to == . Actually, a is b == c only means (a is b) and (b == c) : a and c are not compared.
TRUE (say: not true) to evaluate to FALSE and ! FALSE (say: not false) to evaluate to TRUE. Try using the NOT operator and the equals operator to find the opposite of whether 5 is equal to 7.
No difference, some people consider FALSE to be a constant and thus use the old screaming caps notation.
It's been some time but because this is the first search result for the query I thought this info would be useful.
According to the PSR-2 Coding Style Guide
PHP keywords MUST be in lower case. The PHP constants true, false, and null MUST be in lower case.
Even though you can use the screaming caps notation; if you are trying to follow these guidelines you should be doing it in lowercase. There will be no functional difference either way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With