이는 올해의 배열, 월, 연관 값ksort를 사용하여 PHP로 연도 및 월별로 정렬 하시겠습니까?
function byCalendarMonth($tmpArray) {
$output = [];
foreach ($tmpArray as $value) {
$year = date('Y', strtotime($value['date']));
$month = date('M', strtotime($value['date']));
if (empty($output[$year][$month]))
$output[$year][$month] = ['Indoor' => 0, 'Gym class' => 0];
// Check for incident intensity
$output[$year][$month][$value['category']] += $value['score'];
}
ksort($output);
ksort($output[$year][$month]);
return $output;
}
을 반환 내 PHP 함수이며, 출력이 보이는
Array
(
[2016] => Array
(
[Dec] => Array
(
[Indoor] => 39
[Gym class] => 34
)
[Nov] => Array
(
[Indoor] => 56
[Gym class] => 41
)
[Oct] => Array
(
[Indoor] => 82
[Gym class] => 66
)
[Sep] => Array
(
[Indoor] => 97
[Gym class] => 89
)
[Aug] => Array
(
[Indoor] => 74
[Gym class] => 78
)
[Jul] => Array
(
[Indoor] => 0
[Gym class] => 3
)
[Jun] => Array
(
[Indoor] => 74
[Gym class] => 98
)
[May] => Array
(
[Indoor] => 102
[Gym class] => 58
)
[Apr] => Array
(
[Gym class] => 49
[Indoor] => 106
)
)
[2017] => Array
(
[Mar] => Array
(
[Indoor] => 67
[Gym class] => 53
)
[Feb] => Array
(
[Indoor] => 81
[Gym class] => 47
)
[Jan] => Array
(
[Indoor] => 84
[Gym class] => 49
)
)
)
하지만 난 그냥 1월 같은 ASC에 달 필요
같은 2 월, 월 등 ??
키에 ksort ($ 출력 [$ 년] [$의 달]를) 대체 할 수있는 것은 Gym_class 또는 체육관 수준이어야한다 잘못이나 체육관은 내가 시작을 건너 얼마나 –