Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php

What is the is_link() function in PHP?

Behzad Ahmad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The is_link() function in PHP checks whether the given filename is a symbolic linkA symbolic link serves as a reference to a file or directory as either a relative or absolute path..

Syntax

is_link(string $name): bool

Parameters

name: This specifies the path to the file we want to check.

Return value

is_link() returns true if the provided filename exists and is also a symbolic link. Otherwise, it returns false.

Code

The following code shows how to use the is_link() function.

<?php
$name = "documents"; // a file path which is checked whether it is a symbolic link or not.
if(is_link(name))
{
  echo ("name is a link"); // here if the argument is a valid symbolic link
} 
else
{
  echo ("name is not a link"); // here if the argument is not a valid symbolic link
}
?>

This function produces cache output. We have to clear the cache by using the clearstatcache() function.

RELATED TAGS

php

CONTRIBUTOR

Behzad Ahmad
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring