为什么===比PHP中的==快?

为什么===比PHP中的==快?

问题描述:

为什么===在PHP中比==快?

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

由于相等运算符==临时强制或转换数据类型,以查看其是否等于另一个操作数,而===(运算符)无需进行任何转换,从而减少了工作量,从而提高了速度.

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.