使用bool时,要自动进行类型转换;
<?php
$a = true;
switch($a){
case false:
echo "a";
break;
case 2:
echo "b";
break;
default:
echo "c";
break;
}
?>
输出b;
使用bool时,要自动进行类型转换;
<?php
$a = true;
switch($a){
case false:
echo "a";
break;
case 2:
echo "b";
break;
default:
echo "c";
break;
}
?>
输出b;