PHP匹配的foreach值我有以下陣列:與多維數組
Array
(
[0] => Array
(
[year] => 1
[month] => Array
(
[0] => Array
(
[month] => 2
[value] => 600
)
[1] => Array
(
[month] => 3
[value] => 600
)
[2] => Array
(
[month] => 4
[value] => 600
)
)
)
[1] => Array
(
[year] => 5
[month] => Array
(
[0] => Array
(
[month] => 6
[value] => 80
)
[1] => Array
(
[month] => 7
[value] => 90
)
[2] => Array
(
[month] => 8
[value] => 100
)
)
)
)
而且我有10年還的foreach每個月一個foreach。事情是這樣的:
foreach (range(1, 10) as $year) {
foreach (range(1, 12) as $month) {
$value = $month;
}
}
現在的問題是如何,我可以在foreach數組匹配改變$值,如果$年$月它在陣列中,如果年/月組合它的上$ value值需要是數組中那個月份的數組。
你能改述你想做什麼嗎?我不認爲我理解它。 – ConnectedSystems 2014-10-02 11:54:39