title: Sum values in foreach loop php
body: <pre><code>foreach($group as $key=&gt;$value)
  {
      echo $key. " = " .$value. "&lt;br&gt;";
  }
  </code></pre>
  
  <p>For example:</p>
  
  <blockquote>
    <p>doc1 = 8</p>
    
    <p>doc2 = 7</p>
    
    <p>doc3 = 1</p>
  </blockquote>
  
  <p>I want to count $value, so the result is 8+7+1 = 16. What should i do?</p>
  
  <p>Thanks.</p>