title: Sum array values of the same product
body: <p>i have following type of <code>array</code>. <br /> how can i get desired output from Input <code>array</code>. <br/> Note: <code>array</code> is dynamaic <br/> want sum of <code>comp_size</code> with same <code>product_id</code>. thanks in advance.<br/><em>Input Array</em></p>
  
  <pre><code>array:4 [
    0 =&gt; array:3 [
      "comp_size" =&gt; "4.5"
      "comp_id" =&gt; "10"
      "product_id" =&gt; "1"
    ]
    1 =&gt; array:3 [
      "comp_size" =&gt; "4.5"
      "comp_id" =&gt; "11"
      "product_id" =&gt; "2"
    ]
    2 =&gt; array:3 [
      "comp_size" =&gt; "4.5"
      "comp_id" =&gt; "12"
      "product_id" =&gt; "2"
    ]
    3 =&gt; array:3 [
      "comp_size" =&gt; "4.5"
      "comp_id" =&gt; "13"
      "product_id" =&gt; "2"
    ]
  ]
  </code></pre>
  
  <p>desired result:</p>
  
  <pre><code>[
      0 =&gt; array [
          product_id =&gt; 1
          total_size =&gt; 4.5
      ]
      1 =&gt; array[
          product_id =&gt; 2
          total_size =&gt; 13.5
      ]
  ]
  </code></pre>