How I can turn this
Array
(
[0] => feed
[1] => entry
)
into this:
foreach ($data->feed->entry as $item) { // Yep, we made it }
The first array can have any number of values, so solution needs to be flexible.
EDIT:
Dogbert gave me perfect answer, but to make this more clear for future. What I have is only one array. Based on that I need to get array from object. So my array might look like this also:
[0] => world
[1] => countries
[2] => finland
[3] => helsinki
[4] => people
And then I would need to get:
foreach ($data->world->countries->finland->helsinki->people as $item) {}
1 Answer