The is_link() function checks whether a file is a symbolic link or not. It returns TRUE, if the file exists and is a symbolic link. On failure, it returns FALSE.
Syntax
is_link(file_path)
Parameters
file_path − The file to check
Return
The is_link() function returns TRUE, if the file exists and is a symbolic link. On failure, it returns FALSE.
Example
<?php $mylink = "new"; if(is_link($mylink)) { echo ("link"); } else { echo ("not a link"); } ?>
Output
not a link
Let us see another example.
Example
<?php $mylink = "documents"; if(is_link($mylink)) { echo ("link"); } else { echo ("not a link"); } ?>
Output
not a link