3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); ?> <div> <h1>Example Domain</h1> <p>This domain is established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.</p> <p><a href="http://www.iana.org/domains/example">More information...</a></p> </div> <?php $c = ob_get_clean(); if( ! class_exists('DOMDocument') ) exit("DOMDocument not here"); $doc = new DOMDocument(); $doc->loadHTML("<html><body>Test<br></body></html>"); print_r( $doc->childNodes ); echo PHP_EOL.PHP_EOL; $doc->loadHTML($c); print_r( $doc->childNodes );
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
DOMNodeList Object ( [length] => 2 ) DOMNodeList Object ( [length] => 2 )

preferences:
159.7 ms | 403 KiB | 167 Q