title: Minus two numbers in a foreach loop and display result for each result
body: <p>I have a foreach loop as below. </p>
  
  <p>I'm looking to minus the $wrap->wrap_total from the one that came before it in the loop and struggling!</p>
  
  <pre><code>foreach ($wrap_query-&gt;result() as $wrap)
  {
      echo date("D d M Y", strtotime($wrap-&gt;wrap_date))." - ";
      echo money_format('%n', $wrap-&gt;wrap_total)." - ";
  
      echo "&lt;br /&gt;";
  }
  </code></pre>
  
  <p>Current output is as below:</p>
  
  <p>Sun 07 Aug 2016 - £10,000.00</p>
  
  <p>Sat 06 Aug 2016 - £12,000.00</p>
  
  <p>Fri 05 Aug 2016 - £8,000.00 </p>
  
  <p>What I'd like is:</p>
  
  <p>Sun 07 Aug 2016 - £10,000.00 (-£2,000)</p>
  
  <p>Sat 06 Aug 2016 - £12,000.00 (£4,000)</p>
  
  <p>Fri 05 Aug 2016 - £8,000.00</p>
  
  <p>Any and all help appreciated!</p>