Friday, October 17, 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
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS