@ 2015-04-24T20:53:22Z <?php
$json = json_decode('[
{
"Date":"2014-12-29",
"totalCount":"1"
},
{
"Date":"2015-02-05",
"totalCount":"116"
},
{
"Date":"2015-02-06",
"totalCount":"7"
},
{
"Date":"2015-02-07",
"totalCount":"5"
},
{
"Date":"2015-02-08",
"totalCount":"16"
},
{
"Date":"2015-02-09",
"totalCount":"39"
},
{
"Date":"2015-02-10",
"totalCount":"29"
},
{
"Date":"2015-02-11",
"totalCount":"7"
},
{
"Date":"2015-02-12",
"totalCount":"14"
},
{
"Date":"2015-02-13",
"totalCount":"16"
},
{
"Date":"2015-02-14",
"totalCount":"12"
},
{
"Date":"2015-02-15",
"totalCount":"7"
},
{
"Date":"2015-02-16",
"totalCount":"1"
},
{
"Date":"2015-02-17",
"totalCount":"8"
},
{
"Date":"2015-02-18",
"totalCount":"25"
},
{
"Date":"2015-02-19",
"totalCount":"17"
},
{
"Date":"2015-02-20",
"totalCount":"15"
},
{
"Date":"2015-02-21",
"totalCount":"10"
},
{
"Date":"2015-02-22",
"totalCount":"7"
},
{
"Date":"2015-02-23",
"totalCount":"8"
},
{
"Date":"2015-02-24",
"totalCount":"17"
},
{
"Date":"2015-02-25",
"totalCount":"3"
},
{
"Date":"2015-02-26",
"totalCount":"3"
},
{
"Date":"2015-02-27",
"totalCount":"2"
},
{
"Date":"2015-02-28",
"totalCount":"1"
},
{
"Date":"2015-03-01",
"totalCount":"3"
},
{
"Date":"2015-03-02",
"totalCount":"10"
},
{
"Date":"2015-03-03",
"totalCount":"1"
},
{
"Date":"2015-03-04",
"totalCount":"9"
},
{
"Date":"2015-03-05",
"totalCount":"3"
},
{
"Date":"2015-03-06",
"totalCount":"13"
},
{
"Date":"2015-03-07",
"totalCount":"5"
},
{
"Date":"2015-03-08",
"totalCount":"7"
},
{
"Date":"2015-03-09",
"totalCount":"6"
},
{
"Date":"2015-03-10",
"totalCount":"11"
},
{
"Date":"2015-03-11",
"totalCount":"3"
},
{
"Date":"2015-03-12",
"totalCount":"8"
},
{
"Date":"2015-03-13",
"totalCount":"5"
},
{
"Date":"2015-03-14",
"totalCount":"10"
},
{
"Date":"2015-03-15",
"totalCount":"5"
},
{
"Date":"2015-03-16",
"totalCount":"5"
},
{
"Date":"2015-03-17",
"totalCount":"7"
},
{
"Date":"2015-03-18",
"totalCount":"4"
},
{
"Date":"2015-03-19",
"totalCount":"4"
},
{
"Date":"2015-03-20",
"totalCount":"6"
},
{
"Date":"2015-03-21",
"totalCount":"6"
},
{
"Date":"2015-03-22",
"totalCount":"2"
},
{
"Date":"2015-03-23",
"totalCount":"3"
},
{
"Date":"2015-03-24",
"totalCount":"7"
},
{
"Date":"2015-03-25",
"totalCount":"5"
},
{
"Date":"2015-03-26",
"totalCount":"2"
},
{
"Date":"2015-03-27",
"totalCount":"2"
},
{
"Date":"2015-03-28",
"totalCount":"4"
},
{
"Date":"2015-03-29",
"totalCount":"3"
},
{
"Date":"2015-03-30",
"totalCount":"3"
},
{
"Date":"2015-03-31",
"totalCount":"1"
},
{
"Date":"2015-04-01",
"totalCount":"3"
},
{
"Date":"2015-04-02",
"totalCount":"5"
},
{
"Date":"2015-04-03",
"totalCount":"5"
},
{
"Date":"2015-04-04",
"totalCount":"3"
},
{
"Date":"2015-04-05",
"totalCount":"4"
},
{
"Date":"2015-04-06",
"totalCount":"2"
},
{
"Date":"2015-04-07",
"totalCount":"4"
},
{
"Date":"2015-04-08",
"totalCount":"7"
},
{
"Date":"2015-04-09",
"totalCount":"5"
},
{
"Date":"2015-04-10",
"totalCount":"3"
},
{
"Date":"2015-04-11",
"totalCount":"7"
},
{
"Date":"2015-04-12",
"totalCount":"5"
},
{
"Date":"2015-04-13",
"totalCount":"12"
},
{
"Date":"2015-04-14",
"totalCount":"5"
},
{
"Date":"2015-04-15",
"totalCount":"7"
},
{
"Date":"2015-04-16",
"totalCount":"5"
},
{
"Date":"2015-04-17",
"totalCount":"6"
},
{
"Date":"2015-04-18",
"totalCount":"6"
},
{
"Date":"2015-04-19",
"totalCount":"14"
},
{
"Date":"2015-04-20",
"totalCount":"10"
},
{
"Date":"2015-04-21",
"totalCount":"10"
},
{
"Date":"2015-04-22",
"totalCount":"4"
},
{
"Date":"2015-04-23",
"totalCount":"7"
},
{
"Date":"2015-04-24",
"totalCount":"8"
}
]');
$total = 0;
$count = count($json);
foreach ($json as $key => $obj) {
$total += intval($obj->totalCount);
$json[$key]['totalTotal'] = $total;
}
var_dump($json);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.19 , 8.3.0 - 8.3.7 Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/WVgU0:331
Stack trace:
#0 {main}
thrown in /in/WVgU0 on line 331
Process exited with code 255 . Output for 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Fatal error: Cannot use object of type stdClass as array in /in/WVgU0 on line 331
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 Fatal error: Call to undefined function json_decode() in /in/WVgU0 on line 3
Process exited with code 255 . Output for 4.4.5 - 4.4.9 Fatal error: Call to undefined function: json_decode() in /in/WVgU0 on line 3
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.4 Fatal error: Call to undefined function: json_decode() in /in/WVgU0 on line 3
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Call to undefined function: json_decode() in /in/WVgU0 on line 3
preferences:dark mode live preview
281.28 ms | 401 KiB | 461 Q