PHP extract just the main domain not subdomain from URL
<p>I have a set of URL's in an array.  Some are just domains (http://google.com) and some are subdomains (http://test.google.com).</p>

<p>I am trying to extract just the domain part from each of them without the subdomain.  </p>

<pre><code>parse_url($domain)
</code></pre>

<p>still keeps the subdomain.  </p>

<p>Is there another way?</p>
