Thursday, August 28, 2025
HomeLanguagesPHP linkinfo() Function

PHP linkinfo() Function

The linkinfo() function is an inbuilt function in PHP that retrieves information related to the links. This function checks the link is pointed to by the path that exists.

Syntax:

linkinfo(string $path)

Parameter: This function accepts one parameter that is described below:

  • $path:  This parameter specifies the link for the file path.

Return Values: The ‘linkinfo()’ function returns information about link a file link. It will return a positive integer value on success, otherwise, return -1 for not found the link.

Example 1: The following code demonstrates the linkinfo() function.

PHP




<?php
echo linkinfo('/dev');
?>


Note: Output will be different according to your system.

Output:

5

Example 2: The following code demonstrates the linkinfo() function.

PHP




<?php
    
$num = linkinfo('/gfg') ;
  
if($num == -1){
     echo "Link is not existing";
}
else {
     echo "Link is existing" ;
}
  
?>


Output:

Link is existing

Reference: https://www.php.net/manual/en/function.linkinfo.php

RELATED ARTICLES

Most Popular

Dominic
32244 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6615 POSTS0 COMMENTS
Nicole Veronica
11787 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11832 POSTS0 COMMENTS
Shaida Kate Naidoo
6728 POSTS0 COMMENTS
Ted Musemwa
7009 POSTS0 COMMENTS
Thapelo Manthata
6684 POSTS0 COMMENTS
Umr Jansen
6697 POSTS0 COMMENTS