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