is_link
PHP function
Edit on GitHub ✎
(PHP 4, PHP 5, PHP 7, PHP 8)
Tells whether the filename is a symbolic link
Description
is_link(string $filename): bool
Tells whether the given file is a symbolic link.
Parameters
filenamePath to the file.
Return Values
Returns true if the filename exists and is a symbolic link, false otherwise.
Errors/Exceptions Failure
Examples
Create and confirm if a file is a symbolic link
php
<?php
$link = 'uploads';
if (is_link($link)) {
echo readlink($link);
} else {
symlink('uploads.php', $link);
}
?>