English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP realpath() Function Usage and Example

PHP Filesystem Reference Manual

realpath() returns the normalized absolute path name. This function can remove all symbolic links (such as /./”/../" and unnecessary /)and returns the absolute path name. This function returns false on failure.

Syntax

string realpath ( string $path )

realpath() expands all symbolic links and handles the quotes in the input path '/./', '/../And unnecessary/And returns the normalized absolute path name. The returned path does not contain symbolic links,/./Or/../Component.

Online Example

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

Output Result

C:\PhpProject\index.php

PHP Filesystem Reference Manual