title: dirname($_SERVER["PHP_SELF"]) how to return bar correctly?
body: <pre><code>$path = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
  $path .=$_SERVER["SERVER_NAME"]. dirname($_SERVER["PHP_SELF"]);
  </code></pre>
  
  <p>I have this and this is what happens if I make a echo</p>
  
  <pre><code>echo $path
  http:://localhost/folder
  </code></pre>
  
  <p>and without folder</p>
  
  <pre><code>http:://localhost/
  </code></pre>
  
  <p>if there is a folder not return my bar if I attached a bar as well the result without folder so</p>
  
  <pre><code>$path .=$_SERVER["SERVER_NAME"]. dirname($_SERVER["PHP_SELF"])."/";
  echo $path
  http:://localhost/folder
  http:://localhost//
  </code></pre>
  
  <p>any idea better or more optimal to get what I want?
  to give me a single bar in the two cases</p>