Okay I think this will help you exactly with what you need.
$datewise_data = array
(
'2016-09-26' => 3,
'2016-09-24' => 1,
'2016-09-23' => 2,
'2016-09-22' => 1,
'2016-09-21' => 3
);
$result = array();
foreach ($datewise_data as $date => $value){
$key = date("Y-W", strtotime($date));
//echo $key.'<br>';
if (array_key_exists($key, $result)){
$result[$key] += $value;
} else{
$result[$key] = $value;
}
}
// If you want result year-week pair wise ie. Array ( [2016-39] => 3 [2016-38] => 7 ) Then print it directly
// Can also use ksort() function if needed here
ksort($result); // ksort() function sorts an associative array in ascending order, according to the key
print_r($result);
// If you want results directly in values ie. Array ( [0] => 7 [1] => 3 ) Then sort and print
rsort($result); // rsort() function sorts an indexed array in descending order.
print_r($result);