title: How can I sum objects property of an array using PHP
body: <p>I have an array of objects, and i want to sum value of one of the property.Here is a picture which will show the structre of array.<img src="https://i.stack.imgur.com/p0ajm.png" alt="enter image description here"></p>
  
  <p><em>Here is my code,that doesn't work</em>.</p>
  
  <pre><code>print_r($res);//this appear the structure of array,which i will show.   
  $sum = 0;   
  foreach($res as $key=&gt;$value){ 
     if(isset($value-&gt;sent))   
          $sum += $value-&gt;sent;
     }   
  echo $sum;
  </code></pre>