I have that HTML code
$html = "<h1 id='h1>hhhh111</h1>"
."<h1 id='h2'>hhhh222</h1>"
."<h1 id='h3'>hhhh333</h1>";
I want to print "hhhh222" using DOM and PHP
I am trying that one -
$dom = new DOMDocument;
$dom->loadHTML($html);
echo $dom->getElementsByTagName('h1')[1];
But not working so please help to print "hhhh222" using DOM and PHP.