3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <img src="er" alt="aa" width="641" height="481" class="class1 class2" /> </div> HTML; $doc = new DOMDocument(); $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($doc); foreach ($doc->getElementsByTagName('img') as $img) { $img->setAttribute('class', $img->getAttribute('class') . " myclass"); } echo $doc->saveHTML();
Output for rfc.property-hooks, git.master, git.master_jit
<div> <img src="er" alt="aa" width="641" height="481" class="class1 class2 myclass"> </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:
61.41 ms | 991 KiB | 4 Q