title: How to sum foreach data
body: <p>I have this code</p>
  <pre><code>@foreach($list['query'] as $wallet)
  @php
  if($wallet-&gt;item == 'ETH')
  {
  $url = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&amp;ids=ethereum';
  $data = file_get_contents($url);
  $priceInfo = json_decode($data);
  $marketprice1 = ($priceInfo[0]-&gt;current_price)*($wallet-&gt;primary_balance);
  echo $marketprice1;
  }
  
  if($wallet-&gt;item == 'BTC')
  {
  $url = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&amp;ids=bitcoin';
  $data = file_get_contents($url);
  $priceInfo = json_decode($data);
  $marketprice2 = ($priceInfo[0]-&gt;current_price)*($wallet-&gt;primary_balance);
  echo $marketprice2;
  }
  @endphp
  </code></pre>
  <p>From above I get value (echo $marketprice1) = 1221 and (echo $marketprice2) = 23879
  How to sum value 1 + value 2 ?
  I try with this</p>
  <pre><code>echo $marketprice1+$marketprice2;
  </code></pre>
  <p>but not working, anyone can help</p>