Extract domain from link
<p>I'm looking for a bullet proof way to extract domain (with tld) from any given link - an eqivalent of <code>dirname($path)</code> let's call it domainname($link).</p>

<pre><code>echo domainname("http://example.com/index.html?a=123%1231");
</code></pre>

<p>should print "example.com"</p>
