i want to read xml file from end to start suppose my xml like that :
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<note>
<to>Samy</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't Miss me this weekend!</body>
</note>
i need to read last note first i use code like that
$x = $xmldoc->getElementsByTagName('note');
$nofnews = $xmldoc->getElementsByTagName('note')->length;
for ($i = 0; $i < $nofnews; $i++) {
$item_title = $x->item($i)->getElementsByTagName('to')
->item(0)->nodeValue;
$item_link = $x->item($i)->getElementsByTagName('from')
->item(0)->nodeValue;
}
thank you in advance