realpath()
This function will “clean up” a file path - resolving “/../” and “/./” as well as removing any extra “/” characters - and gives you the “real” file path. If the file or directory does not exist, false is returned.
For the following example, assume we are in the directory /var/www and there exists a directory /php/dev.
$p = realpath('php/dev'); // false $p = realpath('../php/dev'); // false $p = realpath('../../php/dev'); // /php/dev
On Windows, the path will be converted to a Windows style path.
$p = realpath('../../php/dev'); // C:\php\dev
See the manual entry for realpath
