Combine array with same value and add other [duplicate]
PHP Snippet 1:
foreach($data as $key => $elem) {
if (!isset($result[$elem["date"]])) {
$result[$elem["date"]] = $elem;
} else {
$result[$elem["date"]]["count"] += $elem['count'];
$result[$elem["date"]]["audio_click"] += $elem['audio_click'];
}
}
$result = array_values($result); // optional