3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <html> <body> <a href="link.tld">Text<a> <a name="bla">Text<a> </body> </html> HTML; function urlHasString($url, $strings) { foreach($strings as $string) { if((FALSE !== strpos($url, $string))) { return false; } } return true; } function getAllLinks($html){ $dom = new DOMDocument(); if(@$dom->loadHTML($html)) { $xpath = new DOMXpath($dom); $anchors = $xpath->evaluate('//a[normalize-space(@href) != ""]'); foreach($anchors as $element) { $new_href =""; $href = $element->getAttribute('href'); $strings = array('#', 'java', 'jpg', 'jpeg', 'png', 'tel', 'pdf'); echo $href.": ".(urlHasString($href, $strings))."<br>"; } } return; } getAllLinks($html);
Output for git.master, git.master_jit, rfc.property-hooks
link.tld: 1<br>

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