I am pulling in a stdClass Object from a web service and it can have an uknown number of dimensions to it.
It could look like this
[AphiaID] => 106680
[rank] => Subsection
[scientificname] => Heterotremata
[child] => stdClass Object (
[AphiaID] => 106695
[rank] => Superfamily
[scientificname] => Cancroidea
[child] => stdClass Object (
[AphiaID] => 106749
[rank] => Family
[scientificname] => Cancridae
[child] => stdClass Object (
[AphiaID] => 106876
[rank] => Genus
[scientificname] => Cancer
[child] =>
)
)
)
Or it could be simpler like so
[AphiaID] => 106680
[rank] => Subsection
[scientificname] => Heterotremata
[child] => stdClass Object (
[AphiaID] => 106876
[rank] => Genus
[scientificname] => Cancer
[child] =>
)
Basically I won't know the size of it.
What I want to do is loop through and output the rank and scientific name until the child is not an stdClass object.
I'm completley stumped, can anyone help me out please.