3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument; $doc->loadHTML('<html><body id="x"></body></html>'); $body = $doc->getElementById('x'); $div = $doc->createElement('div'); $div->setAttribute('id', 'y'); echo '0: ' . ( $doc->getElementById('y') ? $doc->getElementById('y')->tagName : 'null' ) . PHP_EOL; // div $body->appendChild($div); echo '1: ' . ( $doc->getElementById('y') ? $doc->getElementById('y')->tagName : 'null' ) . PHP_EOL; // div $div->setIdAttribute( 'id', true ); echo '2: ' . ( $doc->getElementById('y') ? $doc->getElementById('y')->tagName : 'null' ) . PHP_EOL; // null
Output for git.master, git.master_jit
0: div 1: div 2: div
Output for rfc.property-hooks
0: null 1: div 2: 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:
58.07 ms | 401 KiB | 8 Q