在这种情况下,我创建了一个学生分数表,计算平均分数,最低分或最高分。它一切正常,但我还需要做一件事,根据这样的特定数据计算等级:
libx264
if marks is 85% and above, give grade A
if marks is 60% and above, give grade B
if marks is 55% and above, give grade C
if marks is 54% and less, mark them as Fail,
答案 0 :(得分:2)
请尝试以下代码,
<?php
$marks = $average;
if ($marks > 85) {
echo "Grade A";
} else if ($marks > 60) {
echo "Grade B";
} else if ($marks > 55) {
echo "Grade C";
}
else{
echo "Fail";
}
?>
&#13;
答案 1 :(得分:1)
您可以使用表达式为switch/case
的{{1}}:
TRUE