• PHP Video Tutorials

PHP - Function realpath()



The realpath() function can return the absolute pathname. This function can remove all symbolic links (like '/./', '/../' and extra '/') and return the absolute pathname. This function can return false on failure.

Syntax

string realpath ( string $path )

This function can expand all symbolic links and resolve references to /./, /../, and extra / characters in an input path and return a canonicalized absolute pathname.

Example

<?php
   echo $real_path = realpath("C:/PhpProject/index.php");
?>

Output

C:\PhpProject\index.php
php_function_reference.htm
Advertisements