Php and xml problem

dear everyone, my problem is that i made xml nodes in variable and then i tried to explode it
my xml is

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<channel>
  <request>
    <username>username</username>
    <request_id>11111</request_id>
    <request_type>request_type</request_type>

    <reply_table>
      <mydata>
        <first_td>0001AA</first_td>
        <second_td>N</second_td>
        <third_td>N</third_td>
        <fourth_td />
        <fifth_td>SU</fifth_td>
        <sixth_td>     HELP DESK</sixth_td>
      </mydata>
      <mydata>
        <first_td>0009IO</first_td>
        <second_td>N</second_td>
        <third_td>N</third_td>
        <fourth_td />
        <fifth_td>SU</fifth_td>
        <sixth_td>     KARIM MOHA</sixth_td>
      </mydata>
      <mydata>
        <first_td>0099PO</first_td>
        <second_td>N</second_td>
        <third_td>N</third_td>
        <fourth_td />
        <fifth_td>SU</fifth_td>
        <sixth_td>     KAMAL AHME</sixth_td>
      </mydata>

    </reply_table>
  </request>
  <request>
    <username>username</username>
    <request_id>11111</request_id>
    <request_type>request_type</request_type>
    <reply_table>
      <mydata>
        <first_td>0001AA</first_td>
        <second_td>N</second_td>
        <third_td>N</third_td>
        <fourth_td />
        <fifth_td>SU</fifth_td>
        <sixth_td>     HELP DESK</sixth_td>
      </mydata>
      <mydata>
        <first_td>0009IO</first_td>
        <second_td>N</second_td>
        <third_td>N</third_td>
        <fourth_td />
        <fifth_td>SU</fifth_td>
        <sixth_td>     KARIM MOHA</sixth_td>
      </mydata>
    </reply_table>
  </request>
</channel>

i want to explode it using the tag <request>, i made it by using for each

$dom= new DOMDocument();
$dom-> loadXML($xmlo);

$counter=1;
$channel=$dom->getElementsByTagName("channel");  // first node of xml
$request=$dom->getElementsByTagName("request");// sub node of xml
foreach( $request as $data_result)
{
/// code goes here
// exploding < mydata>inside the for each of request

}

the problem is in the nodes <mydata> and its inner nodes,
example: the node <first_td> exists 3 times in first request and 2 times in second request, but when I tried to explode it by using for each loop, it shows the 5 nodes at same time,
so how to solve this

What is it that you’re actually trying to do? “exploding” isn’t a very useful term.

Do you want to loop over all of the <request> elements, and for each of those loop over their <mydata> elements (which are inside one <reply_table> for each <request>) and do something with the <[i]something[/i]_td> elements inside?

i made for each loop to explode the node <request> and it is exploding well without repeat , but its inner nodes <mydata> are fully displayed for all requests, it need to make it per request.

notice that the for each loop for <mydata> is insed the for each loop of <request>…

how to make for each as array to get request and my data per request not getting all mydata in a time???

got it or you need to explain more??

thanks for your help inadvance