Output the title of the second book node in the DOM document: in PHP
Description
The following code shows how to output the title of the second book node in the DOM document:.
Example
//from www .j a v a 2 s .c o m
<?php
$dom=new domDocument;
$dom->loadXML("<books><book><title>Title1</title></book><book><title>Title2</title></book></books>");
$x=simplexml_import_dom($dom);
echo $x->book[1]->title;
?>
The code above generates the following result.