Answer the question
In order to leave comments, you need to log in
How to sum duplicate array values?
$vk_stats = json_decode(file_get_contents('https://api.vk.com/method/stats.get?group_id='.$_GET['id'].'&stats_groups=reach&interval=day&intervals_count=14&extended=0&access_token='.$token.'&v='.$v), true);
foreach ($vk_stats['response'] as $vk_stats_res) {
$summ+= $vk_stats_res['reach'];
echo $summ;
}
Answer the question
In order to leave comments, you need to log in
If you output one array (arr), where is the totality of these arrays (item), then something like this:
$summ = 0;
foreach ($arr as $item) {
$summ+= $item['reach'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question