料青山看我应如是
$array = [ 0 => [ 0 => 1500, 1 => 994, 2 => 155, 3 => 530, ], 1 => [ 0 => 1500, 1 => 994, 2 => 9314, 3 => 11, ], 2 => [ 0 => 25, 1 => 5, 2 => 63, 3 => 47, ], 3 => [ 0 => 1500, 1 => 994, 2 => 3, 3 => 51, ],]; // create composite array key $newArray = []; foreach($array as $item) { $compositeKey = $item[0] . '-' . $item[1]; $newArray[$compositeKey] = [ $item[0], $item[1], isset($newArray[$compositeKey][2]) ? $newArray[$compositeKey][2] + $item[2] : $item[2], isset($newArray[$compositeKey][3]) ? $newArray[$compositeKey][3] + $item[3] : $item[3], ]; } echo '<pre>'; print_r(array_values($newArray)); echo '</pre>';输出:Array( [0] => Array ( [0] => 1500 [1] => 994 [2] => 9472 [3] => 592 ) [1] => Array ( [0] => 25 [1] => 5 [2] => 63 [3] => 47 ))http://sandbox.onlinephpfunctions.com/code/940f06c43338d9785b7c47548a0dcbf6e4b2cd75