1ヶ月のうちの特定の日にちの配列(11月)と
曜日によって割り当てるフルーツ用の配列があります。
これを使って該当する曜日に特定の配列を入れ込みたいのですが、何故か23で止まっています・・
どうしてなのかわかりません。
(また今後 1週目、2週目ごと といった制限をかける実装を行う予定です)
$fruitArray = array (
'tue' => 'banana',
'fri' => 'apple',
'sat' => 'orange',
);
$dayArray=
array (
1 => 'tue',
2 => 'wed',
4 => 'fri',
5 => 'sat',
7 => 'mon',
8 => 'tue',
9 => 'wed',
10 => 'thu',
11 => 'fri',
12 => 'sat',
14 => 'mon',
15 => 'tue',
16 => 'wed',
17 => 'thu',
18 => 'fri',
19 => 'sat',
21 => 'mon',
22 => 'tue',
24 => 'thu',
25 => 'fri',
26 => 'sat',
28 => 'mon',
29 => 'tue',
30 => 'wed',
)
foreach($dayArray as $day){
if(isset($fruitArray[$day])){
$result[] = [$day,$fruitArray[$day]];
} else {
$result[] = [$day,null];
}
}
結果は何故か23で止まってしまいます。
array (
0 =>
array (
0 => 'tue',
1 => 'banana',
),
1 =>
array (
0 => 'wed',
1 => '',
),
2 =>
array (
0 => 'fri',
1 => 'apple',
),
3 =>
array (
0 => 'sat',
1 => 'orange',
),
4 =>
array (
0 => 'mon',
1 => '',
),
5 =>
array (
0 => 'tue',
1 => 'banana',
),
6 =>
array (
0 => 'wed',
1 => '',
),
7 =>
array (
0 => 'thu',
1 => '',
),
8 =>
array (
0 => 'fri',
1 => 'apple',
),
9 =>
array (
0 => 'sat',
1 => 'orange',
),
10 =>
array (
0 => 'mon',
1 => '',
),
11 =>
array (
0 => 'tue',
1 => 'banana',
),
12 =>
array (
0 => 'wed',
1 => '',
),
13 =>
array (
0 => 'thu',
1 => '',
),
14 =>
array (
0 => 'fri',
1 => 'apple',
),
15 =>
array (
0 => 'sat',
1 => 'orange',
),
16 =>
array (
0 => 'mon',
1 => '',
),
17 =>
array (
0 => 'tue',
1 => 'banana',
),
18 =>
array (
0 => 'thu',
1 => '',
),
19 =>
array (
0 => 'fri',
1 => 'apple',
),
20 =>
array (
0 => 'sat',
1 => 'orange',
),
21 =>
array (
0 => 'mon',
1 => '',
),
22 =>
array (
0 => 'tue',
1 => 'banana',
),
23 =>
array (
0 => 'wed',
1 => '',
),
)