readlink

string readlink(string linkname) 

Returns the target of a symbolic link.

Returns:

Target of link; FALSE on error

Description:

This function returns the path of the file to which a link points, or FALSE in case of an error.

Example:

Print target of a link
$src = "/home/user/testlink"; 
$target = readlink($src); 

if($target == FALSE) 
{
        echo ("Error"); 
} 
else 
{
        echo ("$src points to $target"); 
} 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.