PHP:第二章——PHP中的switch语句
<?php header("Content-Type:text/html;charset=utf-8"); /* switch语句: */ //例1: /*$i = 99; switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; default: echo "OK" ; }*/ //例2: $i = 50; switch (true) { case $i<60: echo "不及格"; break; case $i<80: echo "良好"; break; case $i<100: echo "优秀"; break; default: echo "请输入正确的成绩范围0-100" ; } ?>