3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<a href="blaa..blaa" class="link-wrapper">click here</a><a href="not.blaa" class="something-else">link-3</a> <a href="blaa" class="link-wrapper">link-1</a><a href="blaa..again" class="link-wrapper">link-2</a>'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); foreach ($xpath->query('//a[contains(@class, "link-wrapper")]') as $a) { $urls[] = $a->attributes->getNamedItem('href')->nodeValue; } foreach ($urls as $url) { echo "$url\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
blaa..blaa blaa blaa..again

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:
156.46 ms | 405 KiB | 5 Q