<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.link.php',
    1 => 'link',
    2 => 'Create a hard link',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Filesystem Functions',
  ),
  'prev' => 
  array (
    0 => 'function.lchown.php',
    1 => 'lchown',
  ),
  'next' => 
  array (
    0 => 'function.linkinfo.php',
    1 => 'linkinfo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/filesystem/functions/link.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.link" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">link</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">link</span> &mdash; <span class="dc-title">Create a hard link</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.link-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>link</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$target</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$link</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>link()</strong></span> creates a hard link.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.link-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">target</code></dt>
     <dd>
      <p class="para">
       Target of the link.
      </p>
     </dd>
    
    
     <dt><code class="parameter">link</code></dt>
     <dd>
      <p class="para">
       The link name.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.link-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.link-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   The function fails, and issues <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>, if <code class="parameter">link</code>
   already exists, or if <code class="parameter">target</code> does not exist.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.link-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Creating a simple hard link</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$target </span><span style="color: #007700">= </span><span style="color: #DD0000">'source.ext'</span><span style="color: #007700">; </span><span style="color: #FF8000">// This is the file that already exists<br /></span><span style="color: #0000BB">$link </span><span style="color: #007700">= </span><span style="color: #DD0000">'newfile.ext'</span><span style="color: #007700">; </span><span style="color: #FF8000">// This the filename that you want to link it to<br /><br /></span><span style="color: #0000BB">link</span><span style="color: #007700">(</span><span style="color: #0000BB">$target</span><span style="color: #007700">, </span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.link-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">This function will not work on
<a href="features.remote-files.php" class="link">remote files</a> as the file to
be examined must be accessible via the server&#039;s filesystem.</span></p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    For Windows only: This function requires PHP to run in an elevated
    mode or with the UAC disabled.
   </span>
  </p></blockquote>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.link-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.symlink.php" class="function" rel="rdfs-seeAlso">symlink()</a> - Creates a symbolic link</span></li>
    <li><span class="function"><a href="function.readlink.php" class="function" rel="rdfs-seeAlso">readlink()</a> - Returns the target of a symbolic link</span></li>
    <li><span class="function"><a href="function.linkinfo.php" class="function" rel="rdfs-seeAlso">linkinfo()</a> - Gets information about a link</span></li>
    <li><span class="function"><a href="function.unlink.php" class="function" rel="rdfs-seeAlso">unlink()</a> - Deletes a file</span></li>
   </ul>
  </p>
 </div>

 
</div><?php manual_footer($setup); ?>