Relative path to the root from the current working directory. I already wrote something just in case there wasn't anything available by default. Does the code look ok?
<?php
$cwd = getcwd();
$directories = explode("/",$cwd);
$dirCount = count($directories);
for ($i = 1; $i < $dirCount; $i+=1)
{
$directories[$i] = "../";
$relativePath .= "{$directories[$i]}";
}
print $relativePath;
?>