php php中==和===的区别是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6316784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between == and === in php
提问by user791180
Possible Duplicate:
The 3 different equals
可能的重复:
3 个不同的等于
Is there any difference between == and === in php? both seem to work fine for me when i use them in a conditional statement. I am very new to programming in PHP. Please consider this and answer in simple words.
php 中的 == 和 === 有什么区别吗?当我在条件语句中使用它们时,两者似乎对我来说都很好。我对 PHP 编程很陌生。请考虑这个问题并用简单的语言回答。
回答by evilone
$a == $b
$a == $b
Equal true: if $ais equal to
$b, after type juggling.
等于 true:如果$a等于
$b,经过类型杂耍。
$a === $b
$a === $b
Identical true: if $ais equal to $b, and they are of the same type.
完全相同:if$a等于$b,并且它们的类型相同。
回答by check123
Identical:
完全相同的:
$a === $b
$a === $b
TRUEif $ais equalto $b, and they are of the same type. (introduced in PHP 4)
TRUEif$a是equalto $b,并且它们是相同的类型。(介绍于PHP 4)
Equal:
平等的:
$a == $b
$a == $b
TRUEif $ais equal to $bafter type juggling.
TRUEif$a等于$b后类型杂耍。
Read here for more: http://www.php.net/manual/en/language.operators.comparison.php
在这里阅读更多信息:http: //www.php.net/manual/en/language.operators.comparison.php

