title: Sum array on key - possible or is the array not structured in a good way?
body: <p>Have built the following array based on an accounting file and want to create sums from the [trans] subarray for all accounts based on the amount. Looked into array_column but have a feeling the array is not built correctly or in an efficient way for this? Any thoughts/suggestions much appreciated.</p>
  
  <p>//Clarification
  Hi! Many thanks. I was probably a bit unclear. For the total population of [trans] I want to sum the amount where the account is the same. So the array above would generate:</p>
  
  <p>[1930] = -150.47-431.63
  [5912] = 150.47
  etc</p>
  
  <pre><code>[#VER] =&gt; Array
      (
          [A1] =&gt; Array
              (
                  [verdatum] =&gt; 20150107
                  [vertext] =&gt; GOOGLE
                  [trans] =&gt; Array
                      (
                          [0] =&gt; Array
                              (
                                  [account] =&gt; 1930
                                  [amount] =&gt; -150.47
                              )
  
                          [1] =&gt; Array
                              (
                                  [account] =&gt; 5912
                                  [amount] =&gt; 150.47
                              )
  
                          [2] =&gt; Array
                              (
                                  [account] =&gt; 2645
                                  [amount] =&gt; 37.62
                              )
  
                          [3] =&gt; Array
                              (
                                  [account] =&gt; 2614
                                  [amount] =&gt; -37.62
                              )
  
                      )
  
              )
  
          [A2] =&gt; Array
              (
                  [verdatum] =&gt; 20150118
                  [vertext] =&gt; Post
                  [trans] =&gt; Array
                      (
                          [0] =&gt; Array
                              (
                                  [account] =&gt; 1930
                                  [amount] =&gt; -431.63
                              )
  
                          [1] =&gt; Array
                              (
                                  [account] =&gt; 5710
                                  [amount] =&gt; 345.30
                              )
  
                          [2] =&gt; Array
                              (
                                  [account] =&gt; 2641
                                  [amount] =&gt; 86.33
                              )
  
                      )
  
              )
  
  )
  </code></pre>