is_link() function in PHP


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

 Live Demo

<?php
$mylink = "new";
if(is_link($mylink)) {
   echo ("link");
} else {
   echo ("not a link");
}
?>

Output

not a link

Let us see another example.

Example

 Live Demo

<?php
$mylink = "documents";
if(is_link($mylink)) {
   echo ("link");
} else {
   echo ("not a link");
}
?>

Output

not a link

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 24-Jun-2020

83 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements