Target a key in a multidimensional array
<p>I have an an array like so.</p>

<pre><code>Array
(
[162 D Dr.] =&gt; Array
    (
        [smi_discover] =&gt; 0
        [smi_totalmonthccsales] =&gt; 12568
        [smi_amex] =&gt; 0
        [smi_visamc] =&gt; 12568
        [smi_ebt] =&gt; 0
        [smi_includeindeal] =&gt; 0
        [smi_debit] =&gt; 0
        [smi_batches] =&gt; 7
    )
 [16ee22 D Dr.] =&gt; Array
    (
        [smi_discover] =&gt; 0
        [smi_totalmonthccsales] =&gt; 125368
        [smi_amex] =&gt; 0
        [smi_visamc] =&gt; 12568
        [smi_ebt] =&gt; 0
        [smi_includeindeal] =&gt; 0
        [smi_debit] =&gt; 0
        [smi_batches] =&gt; 7
    )
)
</code></pre>

<p>This key [162 D Dr.] could be anything. [16e2 D Dree.], [332 D44 Drdds].</p>

<p>How can I loop through this and add up smi_totalmonthccsales and add it to the parent array so I end up with something like this</p>

<pre><code>['total'] = sum of smi_totalmonthccsales in both address arrays
[162 D Dr.] =&gt; Array
    (
        [smi_discover] =&gt; 0
        [smi_totalmonthccsales] =&gt; 12568
        [smi_amex] =&gt; 0
        [smi_visamc] =&gt; 12568
        [smi_ebt] =&gt; 0
        [smi_includeindeal] =&gt; 0
        [smi_debit] =&gt; 0
        [smi_batches] =&gt; 7
    )
</code></pre>

<p>I have tried </p>

<pre><code>foreach($newnewArr as $key) {
    if(isset($key['smi_totalmonthccsales']) &amp;&amp; isset($key)){
        $ccArray[$key]['total'] +=$key['smi_totalmonthccsales'];
    } else {
        $ccArray[$key]['total'] = 0;
    }
}
</code></pre>
