String compare on a bool

后端 未结 3 1009
轮回少年
轮回少年 2020-12-07 00:48

I\'m pretty sure this is a simple fundamental flaw in my newb PHP knowledge, but I was surprised when the following happened:

3条回答
  •  庸人自扰
    2020-12-07 01:18

    Yes, true is equal (==) to a non-empty string. Not identical (===) though.

    I suggest you peruse the type comparison table.

提交回复
热议问题