Uppercase Booleans vs. Lowercase in PHP

后端 未结 11 2080
无人共我
无人共我 2020-12-23 02:33

When I was learning PHP, I read somewhere that you should always use the upper case versions of booleans, TRUE and FALSE, because the \"normal\" lo

11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 03:05

    I used to do C style TRUE/FALSE booleans like all consts, in all caps, until I got on the PSR bandwagon.

    Section 2.5 of PSR-2:

    The PHP constants true, false, and null MUST be in lower case.

    So basically, if you want to play nice with open source style particulars, Booleans gotta be lower case.

提交回复
热议问题