title: Count the percentage of the number of the current iteration in a foreach loop
body: <p>I am trying to build up a script that gets the current percentage of the iteration of a loop.</p>
  
  <p>I have :</p>
  
  <pre><code>&lt;?php
      $counter = 0;
      $total = 100;
      foreach($key as value) {
        $counter = $counter + 1;
        //looping here
        $percentage = $counter/total;
      }
  </code></pre>
  
  <p>In my case outputs within the loop for 5 iterations</p>
  
  <pre><code>0.01
  0.02
  0.03
  0.04
  0.05
  </code></pre>
  
  <p>And I need it to output</p>
  
  <pre><code>20
  40
  60
  80
  100
  </code></pre>
  
  <p>To do something like a current percentage completion.</p>
  
  <p>More random exmaples
  For 10 loops should be</p>
  
  <pre><code>10
  20
  30
  40
  50
  60
  70
  80
  90
  100
  </code></pre>
  
  <p>For 100 loops</p>
  
  <pre><code>1
  2
  .
  .
  100
  </code></pre>
  
  <p>For 6 loops</p>
  
  <pre><code>16.6
  //brain damaged
  </code></pre>
  
  <p>Sorry for the noob math php question but I am in a fog today like no days. Thank you and it's much appreciated.</p>