I have a stdClass object of following format as show in figure.
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