-3

Hello I am trying to list tour name in the 6 node of filter object. Formated xml image is also attached.

This is my loop.

foreach($results->filters->filter[6] as $key=>$tours){

    foreach($tours as $tour_name){
        echo $tour_name->tour->tour_name;
    }
} 

XML-Response

enter image description here

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

1

You need to go one level deeper on your foreach loop

foreach($results->filters->filter[6]->tour as $key=>$tours){

    foreach($tours as $tour){
        echo $tour->tour_name;
    }
} 

Or as PatrickQ suggested below do it all in one loop

foreach($results->filters->filter[6]->tour as $tours){
    echo $tours->tour_name;
} 
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149