Sum value with same code and export it into new file csv
<p>I have this array, with these values:</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [0] =&gt; 001
        [1] =&gt; NAME1
        [2] =&gt; 14

    )

[1] =&gt; Array
    (
        [0] =&gt; 002
        [1] =&gt; NAME2
        [2] =&gt; 2

    )

[2] =&gt; Array
    (
        [0] =&gt; 001
        [1] =&gt; NAME1
        [2] =&gt; 12
}
}
</code></pre>

<p>I want export this in csv format but with sum of all value [2] with same number [0]:</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [0] =&gt; 001
        [1] =&gt; NAME1
        [2] =&gt; 26

    )

[1] =&gt; Array
    (
        [0] =&gt; 002
        [1] =&gt; NAME2
        [2] =&gt; 2

    )
}
}
</code></pre>

<p>I have tried this:</p>

<p><a href="https://stackoverflow.com/questions/27222512/how-to-sum-values-of-the-array-of-the-same-element-id">How to sum values of the array of the same element id</a></p>

<p>but it doesn't work for value [1]. </p>

<p>Could you help me, please?</p>