title: PHP Determining the current url
body: <p>I need to modify my function to return also the current folder I am in. Here is my current function:</p>
  
  <pre><code>function getLinkFromHost($url){  
      $port = $_SERVER['REMOTE_PORT'];  
      $server = $_SERVER['HTTP_HOST'];  
      if($port == 443){  
          $type = "https";  
      } else {  
          $type = "http";  
      }  
      return $type . "://" . $server . "/" . $url;  
  }
  </code></pre>