n00b
n00b

Reputation: 16536

false / FALSE — any difference?

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.

Upvotes: 39

Views: 12826

Answers (3)

Reece Ward
Reece Ward

Reputation: 139

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.

Upvotes: 13

samson
samson

Reputation: 1152

I know I'm late to the party here, but I'll just quote the documentation in case anybody wants an authoritative answer, as I did.

To specify a boolean literal, use the constants TRUE or FALSE. Both are case-insensitive.

In fact, the example immediately following the above uses this fact:

$foo = True; // assign the value TRUE to $foo

PhP is biZarRe.

Upvotes: 8

NibblyPig
NibblyPig

Reputation: 52942

No difference, some people consider FALSE to be a constant and thus use the old screaming caps notation.

Upvotes: 72

Related Questions