<?php
$array = [
'2015-09-23' => [
'user' => [13, 12],
'count' => [
'count' => 2,
'total' => 2,
],
],
'2015-09-24' => [
'user' => [14],
'count' => [
'count' => 1,
'total' => 1,
],
],
'2015-09-25' => [
'user' => [15],
'count' => [
'count' => 1,
'total' => 1,
],
],
'2015-09-26' => [
'user' => [16],
'count' => [
'count' => 1,
'total' => 1,
],
],
'2015-09-27' => [
'user' => [17, 18],
'count' => [
'count' => 2,
'total' => 2,
],
],
'2015-09-28' => [
'user' => [19, 20, 21, 22, 23, 24, 25, 26, 27, 28],
'count' => [
'count' => 10,
'total' => 10,
],
],
];
$total = 0;
foreach ($array as ['count' => ['count' => $c, 'total' => &$t]]) {
$total += $c;
$t = $total;
}
var_export($array);
preferences:
26.06 ms | 402 KiB | 5 Q