is_link()

is_link() — Tells whether the filename is a symbolic link.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

is_link(string $filename): bool

Parameters

ParameterTypeWhat it takes
$filenamestringPath to the file.

Return value

Returns true if the filename exists and is a symbolic link, false otherwise.

Example

A runnable snippet:

$link = 'uploads'; if (is_link($link)) { echo readlink($link); } else { symlink('uploads.php', $link); }

See also

is_dir(), is_file(), readlink(), symlink()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page is_link() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.