Example
<root>
<dog>a</dog>
<cat>b</cat>
<Shelter>North</Shelter>
<Shelter>South</Shelter>
</root>
$obj = simplexml_load_string($XML_ABOVE);
foreach($obj as $key=>$val)
{
print (string)$val;
}
The above will print dog, cat, shelter, shelter
What I need to do, is when an array is encountered (shelter) run it again.
Problem is, the current routine treats this as 4 items instead of 3 (dog, cat, shelter (array)). If I do $val->count everything is showing up as 0. How can I iterate through this and then check if shelter is an array and run it again.
I know how to do it 🙂, just need it as guess to act more like an array. So the foreach products 3 items, I can then look at each item, if the item is an array, run it again.