3v4l.org

run code in 300+ PHP versions simultaneously
<?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->saveHTML($div);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
155.37 ms | 2976 KiB | 8 Q