<?php
$a=0;
$b="";
switch ($a){
case $a<=1:
$b="一等奖";
break;
case $a<=5&&$a>1:
$b="二等奖";
break;
case $a<=9&&$a>5:
$b="三等奖";
break;
default:
$b="没有奖";
}
echo $b;
?>switch 匹配 case 后面的条件 $a=0在switch中判断匹配,就相当于 case 1:一等奖;case 0 :二等奖;case 0,三等奖;因为$a=0,所以匹配 二等奖
不可能吧 ,$a=0符合case $a<=1:$b="一等奖";break;应该是一等奖,你再看看
case 后面只能是 常量的吧 不太清楚