title: PHP Get Subdomain But Not Actual Domain
body: <p>I'm currently using the following to get the subdomain of my site</p>
  
  <pre><code>$subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST'])); 
  </code></pre>
  
  <p>When I use this for <a href="http://www.website.com" rel="nofollow">http://www.website.com</a> it returns "www" which is expected</p>
  
  <p>However when I use this with <a href="http://website.com" rel="nofollow">http://website.com</a> it returns "website" as the subdomain. How can I make absolute sure that if there is no subdomain as in that example, it returns NULL?</p>
  
  <p>Thanks!</p>