title: Get parent directory of running script
body: <p>In PHP, what would be the cleanest way to get the <strong>parent</strong> directory of the current running script relative to the www root? Assume I have:</p>
  
  <pre><code>$_SERVER['SCRIPT_NAME'] == '/relative/path/to/script/index.php'
  </code></pre>
  
  <p>Or just:</p>
  
  <pre><code>$something_else == '/relative/path/to/script/'
  </code></pre>
  
  <p>And I need to get <code>/relative/path/to/</code> with slashes properly inserted. What would you suggest? A one liner is preferred.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I need to get a path relative to the www root, <code>dirname(__FILE__)</code> gives me an absolute path in the filesystem so that won't work. <code>$_SERVER['SCRIPT_NAME']</code> on the other hand 'starts' at the www root.</p>