title: add elements of associative array with same key
body: <p>I have associative array like this </p>
  
  <pre><code> $min_stats=
   array(2) 
  { 
  [0]=&gt; array(3) 
      { 
          ["minute"]=&gt; object(MongoInt64)#13 (1) 
               { 
                  ["value"]=&gt; string(8) "10"
               } 
          ["add"]=&gt; object(MongoInt64)#14 (1) 
              {
                   ["value"]=&gt; string(1) "9"
              }
           ["tag"]=&gt; object(MongoInt64)#15 (1) 
              {       
                  ["value"]=&gt; string(1) "4"
              }
       }
   [1]=&gt; array(3) 
      { 
          ["minute"]=&gt; object(MongoInt64)#13 (1) 
               { 
                  ["value"]=&gt; string(8) "11"
               } 
          ["add"]=&gt; object(MongoInt64)#14 (1) 
              {
                   ["value"]=&gt; string(1) "9"
              }
           ["tag"]=&gt; object(MongoInt64)#15 (1) 
              {       
                  ["value"]=&gt; string(1) "5"
              }
      } 
  } Array
  </code></pre>
  
  <p>Now I want to combine all the key-value pair in the array to get one array.
  The resulting array should be</p>
  
  <pre><code>array(11) 
      { 
          ["minute"]=&gt; int(21) 
          ["add"]=&gt; int(18) 
          ["tag"]=&gt; int(9) 
       } Array
  </code></pre>
  
  <p>so for what I have written is</p>
  
  <pre><code>foreach ($min_stats as $k=&gt;$subArray) {
            foreach ($subArray as $id=&gt;$value) {
              $sumArray[$id]+=$value;
            }
          }
  </code></pre>
  
  <p>but its not giving me correct results, I don't know what I'm doing wrong?
  The $value is coming as 2 means its just counting the elements in the subarray.
  Thanks in advance for the help.</p>