3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(E_ALL); $xml = <<<'_XML' <section> <div id="first-section"> <ul> <li>Test</li> <li>Test</li> </ul> </div> <div id="second-section"> <ul> <li>Test</li> <li>Test</li> </ul> <div id="sub-section"> <h2>Hello World</h2> </div> </div> <div id="third-section"> <ul> <li>Test</li> <li>Test</li> </ul> </div> </section> _XML; libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->loadHTML($xml); echo $doc->saveHTML($doc->getElementById('sub-section')); echo "\n\n"; $newDoc = new DOMDocument(); $newDoc->appendChild($newDoc->importNode($doc->getElementById('sub-section'), true)); echo $newDoc->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<div id="sub-section"> <h2>Hello World</h2> </div> <div id="sub-section"> <h2>Hello World</h2> </div>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
83.2 ms | 405 KiB | 5 Q