3不同等于 [英] The 3 different equals

查看:165
本文介绍了3不同等于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

= == === / code>?



我认为使用一个等号是声明一个变量,而两个等号用于比较条件,最后三个等号用于比较

$ <$> 赋值运算符, == 等于比较运算符 === identical比较运算符

  $ a = $ b Assign将$ a设置为等于$ b。 
$ a == $ b如果$ a等于$ b,则为TRUE。
$ a === $ b如果$ a等于$ b,则为TRUE,它们的类型相同。 (在PHP 4中引入)

有关 == === ,以及使用它们的情况,请参阅文档


What is the difference between =, ==, and ===?

I think using one equal sign is to declare a variable while two equal signs is for a comparison condition and lastly three equal signs is for comparing values of declared variables.

解决方案

You have = the assignment operator, == the 'equal' comparison operator and === the 'identical' comparison operator.

$a = $b     Assign      Sets $a to be equal to $b.
$a == $b    Equal       TRUE if $a is equal to $b.
$a === $b   Identical   TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

For more info on the need for == and ===, and situations to use each, look at the docs.

这篇关于3不同等于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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