3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> Here is an img tag with no qs <img src="http://www.example.com/a.jpg">, an img with no src <img title="to be determined">, and here is another with a qs <img src="http://www.example.com/b.jpg?height=900">. Here is a <iframe src="http://www.example.com/c.jpg?foo=bar"></iframe> and a submit button <input type="image" src="http://www.example.com/d.jpg?boo=far&what=now" alt="Submit"> </div> HTML; $newUrl = 'https://www.example.com/new.jpg'; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach ($xpath->query("//img/@src") as $src) { $src->value = $newUrl; } echo $dom->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<div> Here is an img tag with no qs <img src="https://www.example.com/new.jpg">, an img with no src <img title="to be determined">, and here is another with a qs <img src="https://www.example.com/new.jpg">. Here is a <iframe src="http://www.example.com/c.jpg?foo=bar"></iframe> and a submit button <input type="image" src="http://www.example.com/d.jpg?boo=far&amp;what=now" alt="Submit"> </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:
72.3 ms | 406 KiB | 5 Q