PHP linkinfo() Function
The PHP linkinfo() function is used to verify if a link (pointed to by path) really exists.
Syntax
linkinfo(path)
Parameters
path |
Required. Specify the path to link. |
Return Value
Returns the st_dev field of the Unix C stat structure returned by the lstat system call. Returns a non-negative integer on success, -1 in case the link was not found, or false if an open.base_dir violation occurs.
Example:
Lets assume that we have a file called test.txt in the current working directory. The example below demonstrates on using this function to verify a link.
<?php $target = 'test.txt'; //this file exists $link = 'sampleTest.ttx'; echo linkinfo($target)."\n"; if(link($target, $link)) { echo "Link has been created.\n"; } else { echo "Link can not be created.\n"; } echo linkinfo($link)."\n"; ?>
The output of the above code will be:
2049 Link has been created. 2049
❮ PHP Filesystem Reference