此代码计算正常结果 示例
但我想这样
我该怎么做才能帮我解决这个问题 感谢
<?php
$calculate="$marks";
switch ($calculate)
{
case "1200":
echo "A";
break;
case "800":
echo "B!";
break;
case "600":
echo "C";
break;
default:
echo "";
}
?>
答案 0 :(得分:3)
<?php
$calculate = $marks;
if ($calculate < 800) {
echo "C";
} else if ($calculate < 1200) {
echo "B!";
} else if ($calculate == 1200) {
echo "A";
}
?>