Difference between & and && in PHP

后端 未结 6 2134
面向向阳花
面向向阳花 2020-11-30 03:21

I am confused with & and &&. I have two PHP books. One says that they are same, but the another says they are different. I thought they

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 04:12

    && is & performed on operands reduced to either 1 or 0.

    (In other words, && is a bitwise operator under the caveat that it changes its operands. That is, logical operations are a subset of bitwise operations.)

提交回复
热议问题