3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = " <html> <body> <div id='div1'></div> <div id='div2'> Some text <span>Inside a span</span> <div>Nested div</div> </div> </body> </html>"; $doc = new DOMDocument(); $doc->loadHTML($html); $div = $doc->getElementById("div2"); echo $div->ownerDocument->saveXML($div);
Output for 5.0.0 - 7.2.0
<div id="div2"> Some text <span>Inside a span</span> <div>Nested div</div> </div>
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Z804m on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/Z804m on line 14