84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
if(0=='0') {echo "0=='0'"; }if(0=='') {echo "0==''"; }if('0'=='') {echo "'0'==''"; }
输出0=='0'0==''为什么最后一个不相等呢?
Solve the problem of php string ==? -PHP Chinese website Q&A-How to solve the problem of php string ==? -PHP Chinese website Q&A
Let’s take a look and learn.
这三个if判断,前两个是数值比较,最后一个是字符串比较;
前两个数值比较,会将字符串转换成数字
按照规则:如果字符串以合法的数字数据开始,就用该数字作为其值,否则其值为 0(零);
最后的字符串比较,就是单纯的字符串之间判断是否相同;
Solve the problem of php string ==? -PHP Chinese website Q&A-How to solve the problem of php string ==? -PHP Chinese website Q&A
Let’s take a look and learn.
这三个if判断,前两个是数值比较,最后一个是字符串比较;
前两个数值比较,会将字符串转换成数字
按照规则:如果字符串以合法的数字数据开始,就用该数字作为其值,否则其值为 0(零);
最后的字符串比较,就是单纯的字符串之间判断是否相同;