PHP is realpath()cool, but what if you want to understand this without access to the file system?
I wrote this function, which can return a path with ../, etc. designed for a real path.
It probably doesn't process all the path commands, so let me know if you think I should implement another.
public function resolvePath($path) {
while (strstr($path, '../')) {
$path = preg_replace('/\w+\/\.\.\//', '', $path);
}
return $path;
}
, .