3v4l.org

run code in 500+ PHP versions simultaneously
<?php $pageHTML = '<html> <head></head> <body> <header> <div> <nav>Menu</nav> <span>Another text</span> </div> </header> <section>Section</section> <footer>Footer</footer> </body> </html>'; $dom = new DOMDocument; libxml_use_internal_errors(true); $dom->loadHTML($pageHTML); libxml_use_internal_errors(false); $xpath = new DOMXpath($dom); foreach($xpath->query('/html/body/header/div/*') as $i) { $i->setAttribute('class','my_class'); } echo $dom->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body> <header><div> <nav class="my_class">Menu</nav><span class="my_class">Another text</span> </div> </header><section>Section</section><footer>Footer</footer></body></html>

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:
41.63 ms | 1446 KiB | 4 Q