为什么这段代码输出1? [英] Why does this code output 1?
本文介绍了为什么这段代码输出1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$t = true;
switch($t)
{
case 1*2:
echo 1;
}
推荐答案
请注意 switch/case 做松散比较.
Note that switch/case does loose comparison.
并且 true == 2
是真的一>.
这篇关于为什么这段代码输出1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文