Why is === faster than == in PHP?

前端 未结 12 931
有刺的猬
有刺的猬 2020-12-12 10:39

Why is === faster than == in PHP?

12条回答
  •  无人及你
    2020-12-12 11:30

    Because the equality operator == coerces, or converts, the data type temporarily to see if it’s equal to the other operand, whereas === (the identity operator) doesn’t need to do any converting whatsoever and thus less work is done, which makes it faster.

提交回复
热议问题