3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument; $doc->loadHTML('<html><body id="x"><div id="y"></div></body></html>'); $body = $doc->getElementById('x'); $div = $doc->getElementById('y'); $body->removeChild($div); echo '1: ' . ( $doc->getElementById('y') ? $doc->saveHTML( $doc->getElementById('y') ) : 'null' ) .PHP_EOL; // <div id="y"> unset($div); echo '2: ' . ( $doc->getElementById('y') ? $doc->saveHTML( $doc->getElementById('y') ) : 'null' ) .PHP_EOL; // null
Output for git.master, git.master_jit
1: <div id="y"></div> 2: null
Output for rfc.property-hooks
1: null 2: null

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:
53.07 ms | 401 KiB | 8 Q