3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Load up the HTML in DOMDocument $doc = new DOMDocument; $doc->loadHTML( '<a class="modal">Stuff</a>'); // Or: $doc->loadHTML( $this->form->getInput('image_intro', 'images')); // Create a new XPath object to find the correct <a> tags $xpath = new DOMXPath( $doc); // Iterate over all <a class="modal"> tags foreach( $xpath->query( "//a[@class='modal']") as $a) { // Set the class attribute correctly $a->setAttribute( 'class', $a->getAttribute( 'class') . '-link'); echo $doc->saveHTML( $a); // Print the fixed <a> tag }
Output for git.master_jit, git.master, rfc.property-hooks
<a class="modal-link">Stuff</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:
49.73 ms | 401 KiB | 8 Q