xml和php for循环在另一个for循环中

I have two xml files that are updated with expedia api. I am trying to get the room information and roomcode from one and find that roomcode in the other xml file to retrieve the necesarry information. But I can not seem to figure out how to do this. Here is the xml schema:

XML 1 (hotel_request.xml):

<RoomTypes size="3">
<RoomType roomCode="9995" roomTypeId="157240">
<description>Standard</description>
</RoomType>
</RoomTypes>

XML 2 (room_request.xml)

<rateCode>9995</rateCode>
<roomTypeCode>9995</roomTypeCode>
<rateDescription>Standard - Super Saver- No meals included</rateDescription>
<roomTypeDescription>Standard - Super Saver- No meals included</roomTypeDescription>

I am able to connect to each file successfully, but I have numerous results from the first xml file. So I had to use a foreach loop to go through it and echo each room seperately:

PHP:

//Getting xml file and data

    $data = simplexml_load_file('hotel_request.xml'); 
    $info = $data->HotelSummary;
    //foreach loop to go through and echo out all rooms
    foreach($data->RoomTypes as $rooms):
        $roomCode = $rooms->RoomType['roomCode'];
        $roomName = $rooms->RoomType->description;
    endforeach;

//Now I need to go through this above loop and get the roomCode, then look for that roomCode in the second xml file and get all it's associated information. So this is what I tried which DID NOT work:
foreach($data->RoomTypes as $rooms):
    $roomCode = $rooms->RoomType['roomCode'];
    $roomName = $rooms->RoomType->description;

//Here is where I added in other file
$avail = simplexml_load_file('room_request.xml');

    foreach($avail->HotelRoomResponse->$roomCode as $rooms):
    $promo = $rooms->RateInfos->RateInfo->ChargeableRateInfo->NightlyRatesPerRoom->NightlyRate['promo'];

endforeach;
endforeach;

Please hopefully someone can help me. Thanks!!!