An interesting situation is obtained. I use simplexml_load_file

I deduce:

echo $offer->{'floor'}; всё ок echo $offer->image[$x]; всё ок 

And here with this is not OK (((((((((((

 echo $offer->{'room-space[$x]'}; 

Already tried everything and each part translated into a variable does not help anything (

I hope for your help!

  • 2
    Add sample XML for test. I assume that you need $offer->{'room-space'}[$x] - Small
  • Your code turned out to be the most correct, but my inattention was a mistake. $ offer -> {'room-space'} [$ ii] -> value; Thank!!! - Victor Vasilyev

1 answer 1

echo $offer->{'room-space['.$x.']'};

or

echo $offer->{"room-space[$x]"};

PS Well, it’s still not clear about [ ] - is it your “pointer” to a PHP array or is it just a tag with these elements?

  • if you do not understand leave a comment under questions, why answer with a finger in the sky? - Naumov