3v4l.org

run code in 500+ PHP versions simultaneously
<?php $main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>'; $doc = new DOMDocument(); $doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXpath($doc); $anchors = $xpath->query('//div[contains(@class, "post-inner")]//a'); foreach ($anchors as $a) { $a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue); } echo $doc->saveHTML();
Output for git.master_jit, git.master, rfc.property-hooks
<div class="post-inner"><div class="entry"><p><strong><a href="https://shortdomain.com/api?p=http://example.net">link</a></strong></p></div></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:
45.15 ms | 1972 KiB | 4 Q