link

bool link(string link, string original) 

Creates a hard link.

Returns:

TRUE on success; FALSE on error

Description:

link() creates a hard link, if permissions allow, from the original file to the link. This function doesn’t work on systems not supporting links (for example, Windows only supports shortcuts).

Example:

Create a hard link
$path = "/home/user/orig_file"; 
$path_new = "/home/user/link_file"; 

link($path_new, $path); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.