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:
$_
Got it myself, it's a bit kludgy but it works:
substr(dirname($_SERVER['SCRIPT_NAME']), 0, strrpos(dirname($_SERVER['SCRIPT_NAME']), '/') + 1)
So if I have /path/to/folder/index.php, this results in /path/to/.
/path/to/folder/index.php
/path/to/