0 == 'Y'
if(0 == 'Y'){
echo 111;
}
输出 111
6 回答

手掌心
TA贡献1942条经验 获得超3个赞
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.
数字和字符串比较,字符串会被转换为数字,Y
不含任何的的有效数字字符,因此被转换成 0
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
- 6 回答
- 0 关注
- 429 浏览
添加回答
举报
0/150
提交
取消