realpath

It returns canonicalized absolute pathname

Example

<?php
chdir(‘/usr/local/’);
echo realpath(‘./../../var/www/’);
?>

Ouput

/var/www

Share