为什么===比PHP中的==快? [英] Why is === faster than == in PHP?

查看:101
本文介绍了为什么===比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.

这篇关于为什么===比PHP中的==快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆