title: How do I sum the items in a php loop?
body: <p>I've been learning PHP for a few days and I have an embarrassingly easy question. I want to sum the items in a 500 item loop. I want to figure out the total of 500 + 499 + 498, etc.</p>
  
  <p>Here's my code: 
  
  <pre><code>for ($i=1; $i&lt;=500; $i++)
  {
  
   // echo $i . "&lt;br /&gt;";
   $total = 0;
   $total = $total + $i;
   return $total;
  
  
  }
  
  echo $total . "&lt;br /&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>Can't figure out what I'm doing wrong.</p>