how do i handle multi-level arrays? i have an array that consists of, in this order, continents-countires-cities
for example:
Array
(
[America] => Array
(
[United States of America] => Array
(
[0] => San Francisco
[1] => Berkeley
)
[Mexico] => Array
(
[0] => Mexico City
)
)
[Europe] => Array
(
[Great Britain] => Array
(
[0] => London
)
[Germany] => Array
(
[0] => Berlin
)
)
[Asia] => Array
(
[Japan] => Array
(
[0] => Tokyo
)
[China] => Array
(
[0] => Beijing
)
)
)
based on his inputs, a string will be built where users can define where he wants to go. for example: based on a series of inputs the string $path can look like
$path = America/United States of America/
now based on this $path I would like to display the data in that specific 'folder,' which in this case would be
$folder['America']['United States of America']
so i guess my first question is how can i 'build' that array name so i can check its conents? im not sure if that sentence made sense. im trying to say how can i dynamically tell the script to check
$folder['America']['United States of America'] when it could easily be
$folder['Milky Way']['Earth']['Western Hemisphere']['America']['Mexico]...(and so on) or maybe even
$folder['Bob']['Jake']['Lisa']
there is no specific number of levels for this array. it could have 1 level or 10 levels. all i know are the keys to the arrays, in order of levels.
i had more questions about multi-level arrays but i cant remember them rite now. ill post more later.
THANKS A LOT ANYONE AND EVERYONE!