Thursday, June 11, 2026
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
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS