我有这段代码,它出现了错误:
<?php
$val1 = $totalsum;
$res = ( $val1 / $val2) * 100;
$val2 = count($allcontent);
$res = ( $val1 / $val2) * 100;
// 1 digit after the decimal point
$res = round($res, 1); // 66.7
echo "Success: ";
echo $res;
echo "%";
?>
我尝试添加了这行代码:
if ($res === 0)
{
echo "not eligible";
}
但是它仍然会出现错误。有什么想法吗?