<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.realpath.php',
    1 => 'realpath',
    2 => 'Returns canonicalized absolute pathname',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Функції Файлової Системи',
  ),
  'prev' => 
  array (
    0 => 'function.readlink.php',
    1 => 'readlink',
  ),
  'next' => 
  array (
    0 => 'function.realpath-cache-get.php',
    1 => 'realpath_cache_get',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/filesystem/functions/realpath.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.realpath" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">realpath</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">realpath</span> &mdash; <span class="dc-title">Returns canonicalized absolute pathname</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.realpath-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>realpath</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>realpath()</strong></span> expands all symbolic links and
   resolves references to <code class="literal">/./</code>, <code class="literal">/../</code> and extra <code class="literal">/</code> characters in
   the input <code class="parameter">path</code> and returns the canonicalized
   absolute pathname.  
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.realpath-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       The path being checked.
       <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
        <p class="para">
         Whilst a path must be supplied, the value can be an empty string.
         In this case, the value is interpreted as the current directory.
        </p>
       </p></blockquote>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.realpath-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns the canonicalized absolute pathname on success. The resulting path 
   will have no symbolic link, <code class="literal">/./</code> or <code class="literal">/../</code> components. Trailing delimiters,
   such as <code class="literal">\</code> and <code class="literal">/</code>, are also removed.
  </p>
  <p class="para">
   <span class="function"><strong>realpath()</strong></span> returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure, e.g. if
   the file does not exist.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    The running script must have executable permissions on all directories in
    the hierarchy, otherwise <span class="function"><strong>realpath()</strong></span> will return
    <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    For case-insensitive filesystems <span class="function"><strong>realpath()</strong></span> may or may
    not normalize the character case.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    The function <span class="function"><strong>realpath()</strong></span> will not work for a file which
    is inside a Phar as such path would be a virtual path, not a real one.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    On Windows, junctions and symbolic links to directories are only expanded by
    one level.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: <span class="simpara">
    Оскільки цілочисельний тип в PHP є знаковим, а багато платформ
    використовують 32-бітні цілі числа, деякі функції файлової системи можуть
    повертати неочікувані результати для файлів, розмір яких перевищує 2 ГБ.
   </span></p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.realpath-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>realpath()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />chdir</span><span style="color: #007700">(</span><span style="color: #DD0000">'/var/www/'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'./../../etc/passwd'</span><span style="color: #007700">) . </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'/tmp/'</span><span style="color: #007700">) . </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">/etc/passwd
/tmp</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>Приклад #2 <span class="function"><strong>realpath()</strong></span> on Windows</strong></p>
    <div class="example-contents"><p>
     On windows <span class="function"><strong>realpath()</strong></span> will change unix style paths to
     windows style.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'/windows/system32'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'C:\Program Files\\'</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">C:\WINDOWS\System32
C:\Program Files</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.realpath-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.basename.php" class="function" rel="rdfs-seeAlso">basename()</a> - Повертає останній компонент рядка шляху</span></li>
    <li><span class="function"><a href="function.dirname.php" class="function" rel="rdfs-seeAlso">dirname()</a> - Returns a parent directory's path</span></li>
    <li><span class="function"><a href="function.pathinfo.php" class="function" rel="rdfs-seeAlso">pathinfo()</a> - Returns information about a file path</span></li>
   </ul>
  </p>
 </div>


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