3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate">chocolate</a> <a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate cookies">chocolate</a> <a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate vanilla cookies">chocolate</a> HTML; $doc = new DomDocument(); $fragment = $doc->createDocumentFragment(); $fragment->appendXML($html); $doc->appendChild($fragment); $nodes = $doc->getElementsByTagName('a'); foreach ($nodes as $node) { $node->setAttribute( "title", preg_replace("~\bchocolate(?:(?:\hvanilla)?\hcookies)?\b~", "chocolate chip cookies", $node->getAttribute("title") ) ); } echo $doc->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate chip cookies">chocolate</a> <a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate chip cookies">chocolate</a> <a class="dessert" href="http://mywebsite.com/chocolate.php" title="Try out our new chocolate chip cookies">chocolate</a>

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:
26.97 ms | 406 KiB | 5 Q