3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => [ "platform"=> "Google", "positive"=> "10", "negative"=> "5", "blocked"=> "1", ], 1 => [ "platform"=> "Yandex", "positive"=> "6", "negative"=> "2", "blocked"=> "1", ], 2 => [ "platform"=> "Google", "positive"=> "15", "negative"=> "35", "blocked"=> "23", ] ]; $result = array_values(array_reduce($array, function($carry, $item) { foreach($item as $k => $v) { if (isset($carry[$item['platform']][$k])) { if (is_numeric($v)) $carry[$item['platform']][$k] += $v; } else $carry[$item['platform']][$k] = $v; } return $carry; }, [])); print_r($result);

preferences:
54 ms | 402 KiB | 5 Q