title: Detecting if a URL contains a certain string but NOT as a parameter using PHP
body: <p>I'm trying to force different modes of debugging based on different development urls using PHP. I currently have this set up:</p>
  
  <pre><code>$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === FALSE ? 'http' : 'https';
  $host = $_SERVER['HTTP_HOST'];
  $req_uri = $_SERVER['REQUEST_URI'];
  $currentUrl = $protocol . '://' . $host . $req_uri;
  
  $hostArray = array("localhost", "host.integration", "10.105.0"); //Don't use minification on these urls
  
  
  for ($i = 0; $i &lt; count($hostArray); $i++) {
      if (strpos($currentUrl, $hostArray[$i])) {
          $useMin = false;
      }
  }
  </code></pre>
  
  <p>However, using this method, you would be able to trigger the $useMin = false condition if you were to pass any of the strings in the host array as a parameter, for example:</p>
  
  <pre><code>http://domain.com?localhost
  </code></pre>
  
  <p>How do I write something that will prevent $useMin = false unless the URL starts with that condition (or is not contained anywhere after the ? in the url parameter)?</p>