php switch判断一个数所在的范围

<?php
header("content-type:text/html;charset=utf8");
$score=70;
switch($score) 
{
  case $score>=90 && $score<=100:
    echo "优秀<br>";
    break;
 case $score>=80 && $score<90:
    echo "良好<br>";
    break;
 case $score>=70 && $score<80:
    echo "中等<br>";
    break;
 case $score>=60 && $score<70:
    echo "及格<br>";
    break;
 case $score>=0 && $score<60:
    echo "不及格<br>";
    break;
 default:
    echo"成绩输入错误<br>";
}
?>

 

posted @ 2016-03-02 10:48  绿尘枫  阅读(5169)  评论(0编辑  收藏  举报