3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html=<<<HTML <h1><a href="http://www.website.com/article/slug-that-has-undetermined-amount-of-hyphens/12345">Whatever</a></h1> <p>Here is a url as plain text: http://www.website.com/article/sluggy-slug</p> <div>Here is a qualifying link: <a href="http://www.website.com/article/slugger-sluggington-jr/666">Whatever</a></div> HTML; $dom = new DomDocument(); $dom->loadHTML($html); foreach ($dom->getElementsByTagName('a') as $item) { $output[] = $item->getAttribute('href'); } var_export($output);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'http://www.website.com/article/slug-that-has-undetermined-amount-of-hyphens/12345', 1 => 'http://www.website.com/article/slugger-sluggington-jr/666', )

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.68 ms | 405 KiB | 5 Q