9
我需要遍歷一個動態數組。該陣列將類似於以下內容:遍歷數組獲取鍵和值
Array
(
[2010091907] => Array
(
[home] => Array
(
[score] => Array
(
[1] => 7
[2] => 17
[3] => 10
[4] => 7
[5] => 0
[T] => 41
)
[abbr] => ATL
[to] => 2
)
[away] => Array
(
[score] => Array
(
[1] => 0
[2] => 7
[3] => 0
[4] => 0
[5] => 0
[T] => 7
)
[abbr] => ARZ
[to] => 2
)
[weather] =>
[media] => Array
(
[tv] => FOX
[sat] => 709
[sathd] => 709
[radio] => Array
(
[home] => 153
[away] => 90
)
)
[bp] => 13
[yl] =>
[qtr] => Final
[down] => 0
[togo] => 0
[clock] => 00:26
[posteam] => ARZ
[note] =>
[redzone] =>
[stadium] => Georgia Dome
)
我需要它是動態的,用於測試目的,我需要能夠通過調用它:
echo "Key: $key; Value: $value<br />\n";
我要去以後再把這些信息放到一個mysql數據庫中,但現在我需要刷新數組並找出如何格式化數據。
任何幫助表示讚賞。
這肯定工作。我只需要弄清楚,如何使用這些信息,我可以將對象從數組中調出,例如「home」的值等。 – drewrockshard 2010-09-20 17:12:13
我最初認爲您可能想要獲取各個鍵的值,但我忽略了它因爲你有很多重複的按鍵,比如'home','away','to'等等。很高興你能使用它! – jeroen 2010-09-20 18:04:29
is_array救了我的屁股 – danielad 2015-03-25 13:51:18