3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array ( 0 => Array ( 'CSTNOC' => 1976, 'TOTALQTY' => 2 ), 1 => Array ( 'CSTNOC' => 5400, 'TOTALQTY' => 1 ), 2 => Array ( 'CSTNOC' => 5400, 'TOTALQTY' => 2 ) ); $new = array(); foreach($arr as $k=>$v){ $new[$v['CSTNOC']] = isset($new[$v['CSTNOC']]) ? $new[$v['CSTNOC']] + $v['TOTALQTY'] : $v['TOTALQTY']; } print_r($new);

preferences:
35.09 ms | 404 KiB | 5 Q