title: php sum values of multiple subarrays if subarrays are not the same length (not the same number of keys)
body: <p>Have such array (placed code here <a href="http://codepad.viper-7.com/mTqf6W" rel="nofollow noreferrer">http://codepad.viper-7.com/mTqf6W</a>)</p>
  
  <pre><code>Array
  (
  [17,bank stmt,1,23,3,2014] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [RecordDay] =&gt; 17
                  [Amount] =&gt; 1.5
              )
      )
  [17,invoice,2,17,3,2014] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [RecordDay] =&gt; 17
                  [Amount] =&gt; 0.21
              )
  
          [1] =&gt; Array
              (
                  [RecordDay] =&gt; 17
                  [Amount] =&gt; 1
              )
  
      )
  
  
  )
  </code></pre>
  
  <p>Want to get totals of <code>[Amount]</code> for each subarray. For the first subarray there is only one key, so Total equals to <code>[Amount]</code>. But for the second subarray there are 2 keys (may be more than 2 keys), so in some way need to sum all <code>[Amount]</code></p>
  
  <p>For <code>[17,bank stmt,1,23,3,2014]</code> would be 1.5, <code>[17,invoice,2,17,3,2014]</code> would be 1.21 </p>
  
  <p>Following some examples <a href="https://stackoverflow.com/questions/1404422/php-array-sum-on-multi-dimensional-array">PHP Array_Sum on multi dimensional array</a> trying to create code. Created </p>
  
  <pre><code>$values = array('Amount' =&gt; 0);
  $counter = 0;
  foreach ($temp_array as $key =&gt; $item) {
  $values['Amount'] += $item[$counter]['Amount'];
  $counter++;
  }
  </code></pre>
  
  <p>Get error 'Notice: Undefined offset: 2'    </p>