开发者

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 pr开发者_运维知识库efer lowercase.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜