<?php
$statics = ['1481069313' => ['added' => 2, 'removed' => 8],'1481072913' => ['added' => 7, 'removed' => 12], '1481674113' => ['added' => 18, 'removed' => 5]];
function getStatics($staticsCat, $firstTimestamp, $lastTimestamp) {
global $statics;
foreach($statics as $timestamp => $cat){
if ($timestamp >= $firstTimestamp && $timestamp <= $lastTimestamp) {
$count += $cat["$staticsCat"];
}
}
echo $count;
}
getStatics('added', strtotime('2016-12-06 00:00:00'), strtotime('2016-12-08 00:00:00'));