how to sum all column values in multi-dimensional array have same value of keys? : <p>i have array multi-dimensional like this and i want sum all column "quota" values have same id and same ip and same visited ip</p>

<pre><code>$array = array(
    "0" =&gt; array(
        "id" =&gt; 1,
        "ip" =&gt; 10.40.47.5,
        "visited_ip" =&gt; 10.40.40.10,
        "quota" =&gt; 20,
    ),
    "1" =&gt; array(
        "id" =&gt; 2,
        "ip" =&gt; 10.40.47.20,
        "visited_ip" =&gt; 10.40.40.10,
        "quota" =&gt; 10,
    ),
    "2" =&gt; array(
        "id" =&gt; 1,
        "ip" =&gt; 10.40.47.5,
        "visited_ip" =&gt; 10.40.40.10,
        "quota" =&gt; 30,
    )
);
</code></pre>

<p>and i want result like this  </p>

<pre><code>$array = array(
        "0" =&gt; array(
            "id" =&gt; 1,
            "ip" =&gt; 10.40.47.5,
            "visited_ip" =&gt; 10.40.40.10,
            "quota" =&gt; 50,
        ), 
        "1" =&gt; array(
            "id" =&gt; 2,
            "ip" =&gt; 10.40.47.20,
            "visited_ip" =&gt; 10.40.40.10,
            "quota" =&gt; 10,
        ),
    );
</code></pre>

<p>i need your help   </p>
