1
qiayue PRO 第一句你用三个等号试一试?
|
5
Sunyanzi 2013 年 6 月 12 日
RTFM ...
-------------------- If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically. These rules also apply to the switch statement. The type conversion does not take place when the comparison is === or !== as this involves comparing the type as well as the value. <?php var_dump(0 == "a"); // 0 == 0 -> true var_dump("1" == "01"); // 1 == 1 -> true var_dump("10" == "1e1"); // 10 == 10 -> true var_dump(100 == "1e2"); // 100 == 100 -> true switch ("a") { case 0: echo "0"; break; case "a": // never reached because "a" is already matched with 0 echo "a"; break; } |
6
msg7086 2013 年 6 月 12 日
var_dump("1" == "01"); // 1 == 1 -> true
var_dump("10" == "1e1"); // 10 == 10 -> true 对这两句话感到绝望了…… |
8
F0ur 2013 年 6 月 18 日
==是等于 !=是不等于
===是类型和数值都相等,曰恒等 !==是类型或数值不相等 |
9
jevonszmx 2013 年 7 月 2 日
1、==或者!=,手册:如果比较一个整数和字符串,则字符串会被转换为整数。
2、!==是===的相反,会同时比较值和类型的。 |