title: How to sum the values of an associative array?
body: <p>How can I add the array elements by key? Thanks in advance!
  Please find the code snippet below</p>
  
  <pre><code>(
      [2] =&gt; Array
          (
              [addition_price] =&gt; Array
                  (
                      [0] =&gt; 0
                      [1] =&gt; 40
                      [2] =&gt; 40
                  )
  
      )
  
  [3] =&gt; Array
      (
          [addition_price] =&gt; Array
              (
                  [0] =&gt; 100
              )
  
      )
  
  )
  </code></pre>
  
  <p><strong>Desired result:</strong></p>
  
  <blockquote>
    <p>[2] = 0 + 40 + 40 = 80</p>
    
    <p>[3] = 100</p>
  </blockquote>