Example 1 — Check That a Link Exists
Create a symbolic link and use linkinfo() to confirm it can be read.
<?php
$link = __DIR__ . '/current';
@unlink($link);
symlink('releases/v1', $link);
if (linkinfo($link) !== -1) {
echo "The link exists", PHP_EOL;
} How It Works
- symlink() creates a link named current.
- linkinfo() asks the system about the link and returns a device number.
- The number is not -1, so the link is valid.
- The message is printed.

