xml question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I've had something strange come up with xml.  I get an instance of
SoapClient and get data (my $values variable) from the client.  If I
just extract the data for one node, everything is fine.  If it is in a
loop, then it gives me an "internal server error" most of the time, but
occassionally works.  I want to extract the last name and first name for
a given IndvID for each of the IndvID.  These data are repeated many
time for each, so that is the reason for the "break"s.  Here is the code
snippet where it fails:

$n = count($people);  // $people is an array of arrays of values
$input = array();
for ($i=0; $i<$n; $i++) {
   $input['token'] = $token;  // $token is previously obtained
   $input['personid'] = $people[$i]['IndvID'];
   $values = $tokenClient->getPersonbyID($input)->getPersonbyIDResult;
   $q = simplexml_load_string($values->any);
   foreach ($q->NewDataSet as $node) {
     foreach ($node->dbs as $x) {
       $l = $x->LastName;
       $f = $x->FirstName;
       $people[$i]['person'] = $l . ', ' . $f;

If I put in the statement

if ($i>0) break;

after the "$q =" line there is never a problem.  It gets the first one.
  If I put it after the first foreach, then I get the problem most of
the time.  I have tried changing $q to $q[$i] and the results are the same.

I searched the manual and could not see any kind of "free" or "destroy"
statement in the SimpleXml stuff.  I have also tried unsetting $q, but
nothing helped.  This is on a shared server.

So, can anyone tell me what I am missing here?

Site Timeline