title: Division by zero error
body: <p>I have this code throwing up the error:</p>
  
  <pre><code>&lt;?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 "%";
  
  ?&gt;
  </code></pre>
  
  <p>I have tried adding this line: </p>
  
  <pre><code>if ($res === 0) 
  { 
     echo "not eligible"; 
  }
  </code></pre>
  
  <p>but it still gives the error. any ideas?</p>