> 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
KISS - Keep It Simple Stupid. Haha..
>
> 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?
I've tried that and $xml->RES->R only goes through one record
$xml->RES->R[0] and then it stops. What I did find that worked was this.
$i = 0;
while (isset($xml->RES->R[$i]) || !empty($xml->RES->R[$i]) {
// do stuff
$i++;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php