PHP Tutorial - PHP realpath() Function






Definition

This function removes all symbolic links (like '/./', '/../' and extra '/') and returns the absolute pathname.

Syntax

PHP realpath() Function has the following syntax.

realpath(path)

Parameter

ParameterIs RequiredDescription
pathRequired.Path to check

Return

This function returns FALSE on failure.

The realpath() function returns the absolute pathname.

Example

Get the real path for a relative path


<?php
echo realpath("..\..\test.txt");
?>