Quick Array question
Posted: Sat Dec 05, 2009 5:32 am
Howdy,
I was wondering if it is possible to loop through a multidimensional array using the foreach function.
The array in question is structured as such:
Array
(
[1] => Array
(
[key1] => value
[key2] => value
[key3] => value
[key4] => value
[key5] => value
[key6] => value
[key7] => value
)
The first array is a numerical index with the second array representing a row of data to be loaded in to a database. I want to loop through the main array and for each index output each key => value pair then upload to database and repeat.
Is this possible with a foreach statement?
I was wondering if it is possible to loop through a multidimensional array using the foreach function.
The array in question is structured as such:
Array
(
[1] => Array
(
[key1] => value
[key2] => value
[key3] => value
[key4] => value
[key5] => value
[key6] => value
[key7] => value
)
The first array is a numerical index with the second array representing a row of data to be loaded in to a database. I want to loop through the main array and for each index output each key => value pair then upload to database and repeat.
Is this possible with a foreach statement?