PHP TRUE vs true -- Case Differences

When you use "TRUE" as in all caps, you are saying that the Boolean is a constant. If you are saying that the variable value is a constant value, you are saying that the value is 1 and not 'true'. This has always been a bit of contention for me, because I've always felt that Boolean values should be more than numerical values. Those from the C background or languages where there are no Boolean keywords, may prefer the constant, since it is familiar to them. Well, that is to say that I have a C++ background, which does have Boolean keywords (that is also to say that those who have used C, before they finally added the Boolean keywords to the language in the C99 Standard). That is beside the point, it is true that computers don't understand "true" or "false" the words. It is say that programming isn't about what computers understand, but what people understand.

So, it is a standards subject and up to a matter of preference rather than a matter of what you should or should not do. I prefer to believe that "true" and "false" are keywords in the language, but the technical background is that they are constants with case sensitivity turned off.

I will say, to further my point is that, you should try this code sometime.

[code lang="php"] if( 0 === false ) { echo "0 is the same as 'false'."; } if( 1 === TRUE ) { echo "1 is the same as 'TRUE'."; } [/code]

You will find the answer isn't exactly accurate, in the same sense that a numerical value is not the same as a Boolean value, but if TRUE is a constant and then the value should be one (I really forget what the value might be, it could very well be 'TRUE' to ensure that 1 !== TRUE).