好的......我討厭數組的......我不理解他們,也不喜歡和他們一起工作......但我正在一個項目中工作,我無法控制數據,但需要一種方法把它整理成我可以操縱的格式...通過嵌套的PHP數組操作和循環
因此,數據看起來是這樣的:
$arr = Array (
[1] => Array ([December] => a date here [December (2)] => a location here... [December (3)] => an event here...)
[2] => Array ([December] => a date here [December (2)] => a location here... [December (3)] => an event here...)
[3] => Array ([December] => a date here [December (2)] => a location here... [December (3)] => an event here...)
[4] => Array ([December] => a date here [December (2)] => a location here... [December (3)] => an event here...)
[5] => Array ([December] => a date here [December (2)] => a location here... [December (3)] => an event here...)
)
首先,我需要改變「月」,「十二月(2 )'&'December(3)'to'Date','Location'&'Event'...
然後,我需要一種方法來引用每個數組中的新鍵,然後我可以將其插入到數據庫中?
喜歡的東西:
$arr[1][Date];
,但我想$改編[1]將需要類似$改編[$ i] ...?
有人可以幫我這個嗎?這將是非常讚賞...我試圖讓這個正確的某個時候...
你最好開始習慣數組,它們是PHP的心臟,靈魂,麪包和黃油。 – deceze 2010-07-05 01:19:30
我改變了標題,因爲你的問題與排序無關。 – Artefacto 2010-07-05 01:22:17
是的,好多了,謝謝! – Indigo 2010-07-05 01:38:14