3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <html> <head> <title>Urls</title> </head> <body> <a href="https://www.google.com">Google</a> <a href="https://facebook.com">Facebook</a> <a href="http://www.example.com">Example</a> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <h1>Heading</h1> <a href="www.example.com">Example</a> </body> </html> HTML; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html); $xpath = new DOMXPath($dom); $result = []; foreach ($xpath->query("//@href") as $href) { $noQueryString = explode('?', $href->nodeValue, 2)[0]; if (strpos($noQueryString, 'www.example.com') !== false) { $result[] = $href->nodeValue; } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'http://www.example.com', 1 => 'www.example.com', )

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