Re: Object Array?

From: Date: Thu, 18 May 2006 19:45:07 +0000
Subject: Re: Object Array?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236426@lists.php.net to get a copy of this message
don't bother trying to print_r() or var_dump() SimpleXML objects you'll fry your brain - seriously you'll never get anything that makes sense - this is due to the way simpleXML using iterators or something like that - it's a bit like voodoo to me too so I find it hard to explain. I'm sure there is a saying about 'when things are so simple, you just don't get' that's applicable here :-P Jay Paulson wrote:
I tried with no success yesterday to get an answer to this question so I'll try again. I have an object from using simpleXML and inside that object is an array holding even more objects. However, it's not acting like an array and therefore I can't go through it. (i.e. I can't use the count function to see how big it is and loop through it)
use foreach on it (I think 'it' is a weirdo object that implements an iterator interface - which pretty much sums up simpleXML ;-): foreach ($xml->RES->R as $r) { echo $r->U, $r->UD; // etc } does that get you anywhere?

« previous php.general (#236426) next »