""、0、null三个值用var_dump打印结果如下:
string(0) "" int(0) NULL
用== 对其进行比较:
if("" == 0){ echo "1";}else{ echo "2";}if("" == null){ echo "3";}else{ echo "4";}if(null == 0){ echo "5";}else{ echo "6";}
结果为:
1
3
5
===比较
if("" === 0){ echo "1";}else{ echo "2";}if("" === null){ echo "3";}else{ echo "4";}if(null === 0){ echo "5";}else{ echo "6";}
结果为:
2
4
6
==比较的是值,===比较的不止是值还有类型