Thursday, September 4, 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
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS