I need something list all the nodes of an XML file in a similar way to how the print_r() function lists out an array.
So it will list out all the fields in the correct order but so that I can actually do something with them.
Code: Select all
Array
(
[a] => apple
[b] => banana
[c] => Array
(
[0] => x
[1] => y
[2] => z
)
[d] => Array
(
[0] => x
[1] => y
[2] => Array
(
[0] => Keeps going deeper...
[1] => etc...
)
)
)At the moment I am doing this:
Code: Select all
foreach($xml->children() as $child1){
foreach($child1->children() as $child2){
foreach($child2->children() as $child3){
// Obviously this could keep going for ages...
}
}
}Or something that can count all nodes within the feed and just list them one by one.
I'm sure there must be a way to do this, I just can't work out the logic.