Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Link

A link, or hyperlink, connects two resources, allowing navigation or reference from one to the other.

In web development, links are expressed as HTML <a> anchor elements and <link> elements. PHP generates both when rendering HTML.

In the filesystem, a link is a reference to a file or directory. PHP provides link() for hard links and symlink() for symbolic links. Both are used for deployment strategies, shared asset management, and plugin architectures.

In data structures, a linked list uses node-to-node references to chain elements. PHP does not have a native linked list, but SplDoublyLinkedList provides one.

In REST APIs, links in responses describe available actions and related resources as URLs.

<?php

    // Filesystem symlink
    symlink('/var/www/releases/v2.0', '/var/www/current');
    
    // HTML link generation
    $url = htmlspecialchars('https://www.php.net/', ENT_QUOTES, 'UTF-8');
    echo "<a href=\"$url\">PHP Manual</a>";
    
    // HTML <link> element for stylesheet
    echo '<link rel="stylesheet" href="style.css">';

?>

Documentation

See Also