0

I have a stdClass object of following format as show in figure. enter image description here

I want to access NumberOfUnits. I have tried
$finalbooking->HotelReservations->HotelReservation->RoomStays->RoomStay->RoomTypes{0}->{'@attributes'}->NumberOfUnits;

and

$finalbooking->HotelReservations->HotelReservation->RoomStays->RoomStay->RoomTypes->{'@attributes'}->NumberOfUnits;

but no luck. Any help would be appreciated. Thank You

VijayRana
  • 953
  • 1
  • 13
  • 38
  • For your example also see see the linked ones: http://stackoverflow.com/a/10333200 and http://stackoverflow.com/q/33157296 – Rizier123 Jan 12 '16 at 10:10
  • Never mind, I made it working. I just forgot to point the '0' object. the solution was `$finalbooking->HotelReservations->HotelReservation->RoomStays->RoomStay->RoomTypes->{'0'}->{'@attributes'}->NumberOfUnits;` – VijayRana Jan 12 '16 at 10:21

0 Answers0