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