DirectoryIterator::isLink

Determine if current DirectoryIterator item is a symbolic link

&reftitle.description; public `bool` `DirectoryIterator::isLink`

Determines if the current `DirectoryIterator` item is a symbolic link.

&reftitle.parameters; &no.function.parameters;
&reftitle.returnvalues;

Returns &true; if the item is a symbolic link, otherwise &false;

&reftitle.examples;

### A `DirectoryIterator::isLink` example

This example contains a recursive function for removing a directory tree.

    <?php
    /**
     * This function will recursively delete all files in the given path, without
     * following symlinks.
     *
     * @param string $path Path to the directory to remove.
     */
    function removeDir($path) {
        $dir = new DirectoryIterator($path);
        foreach ($dir as $fileinfo) {
            if ($fileinfo->isFile() || $fileinfo->isLink()) {
                unlink($fileinfo->getPathName());
            } elseif (!$fileinfo->isDot() && $fileinfo->isDir()) {
                removeDir($fileinfo->getPathName());
            }
        }
        rmdir($path);
    }

    removeDir('foo');
    ?>

&reftitle.seealso;

- `DirectoryIterator::getType`
- `DirectoryIterator::isDir`
- `DirectoryIterator::isDot`
- `DirectoryIterator::isFile`