XML : PHP - Error when print array directly

I have an array produced from parsing XML using below code:

  $htlab = simplexml_load_string($data);    

But every time I try to print array directly then face error:

  if (isset($htlab)){  echo 'total = '.count($htlab); //not error  echo $htlab[6][3]; //error  echo $htlab[6]['HotelName']; //errorr  }    

The Error Message:

  Severity: Warning    Message: main(): Cannot add element Results number 6 when only 0 such elements exist    

Any solution?

No comments:

Post a Comment