php8.5
Home/ Manual/ spl / splfileinfo/ SplFileInfo::isLink

SplFileInfo::isLink

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

Tells if the file is a link

Description

SplFileInfo::isLink(): bool

Use this method to check if the file referenced by the SplFileInfo object is a link.

Parameters Parameters

Return Values

Returns true if the file is a link, false otherwise.

Examples

SplFileInfo::isLink() example

php
<?php
$info = new SplFileInfo('/path/to/symlink');
if ($info->isLink()) {
    echo 'The real path is '.$info->getRealPath();
}
?>

See Also

  • SplFileInfo::getRealPath

Source: reference/spl/splfileinfo/islink.xml · from the official PHP manual (php/doc-en)