Remove everything but the domain with PHP
<p>My current js formula removes http://, https://, www and anything after '/'.</p>

<pre><code>   function cleanUrl(url) { 
        return url.replace(/^(http(s)?:\/\/)?(www\.)?/gi,"");
    }
</code></pre>

<p>E.G:
<a href="http://www.google.com/piza" rel="nofollow">http://www.google.com/piza</a>
returns google.com</p>

<p>How can I do remove everything but the domain in one step but with PHP?</p>
