>>>> 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? > > what happens when you do: > > foreach ($xml->RES->R as $key => $r) { > echo $r->__toString(); > // or > echo $key; > } > > ? That actually works. Strange because I tried this method first yesterday and spent over an hour trying to get it to work and now it's working? AH! :) Below is the code I use. foreach ($xml->RES->R as $key => $r) { echo $r->U.'<br>'; echo $r->UD.'<br>'; echo $r->UE.'<br>'; echo $r->T.'<br>'; echo $r->RK.'<br>'; echo $r->S.'<br>'; echo $r->LANG.'<br>'; echo '<hr>'; } >> >> >> 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. > > in what way does it stop? > >> >> $i = 0; >> while (isset($xml->RES->R[$i]) || !empty($xml->RES->R[$i]) { >> // do stuff >> $i++; >> } > > odd. I don't suppose $xml->RES->R has any methods does it? like hasChildren() > or > hasAttributes()?