title: Detect if a user is on a subdomain, and then add a variable using PHP?
body: <p>I would like to know how to create a PHP IF Statement that detects if a user is loading/on a certain URL. In my case it's:</p>
  
  <pre><code>www.design.mywebsite.com
  </code></pre>
  
  <p>The IF Statement needs to cover the whole subdomain, EG the URL will also have to be detected:</p>
  
  <pre><code>www.design.mywebsite.com/filename.php
  </code></pre>
  
  <p>Once an IF statement is established, I want to add a PHP variable. So it might help others, let's call it:</p>
  
  <pre><code>$myvariable = "Hey there! You're on my subdomain";
  </code></pre>
  
  <p><strong>So To Sum It Up:</strong>
  The final code should look something like this...</p>
  
  <pre><code>&lt;?php
    if //Code to detect subdomain// {
      $myvariable = "Hey there! You're on my subdomain";
    }
  ?&gt;
  </code></pre>