<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Gives information about a file or symbolic link</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.linkinfo.html">linkinfo</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mkdir.html">mkdir</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.lstat" class="refentry"> <div class="refnamediv"> <h1 class="refname">lstat</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">lstat</span> — <span class="dc-title">Gives information about a file or symbolic link</span></p> </div> <div class="refsect1 description" id="refsect1-function.lstat-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>lstat</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> )</div> <p class="para rdfs-comment"> Gathers the statistics of the file or symbolic link named by <em><code class="parameter">filename</code></em>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.lstat-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">filename</code></em></span> <dd> <p class="para"> Path to a file or a symbolic link. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.lstat-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> See the manual page for <span class="function"><a href="function.stat.html" class="function">stat()</a></span> for information on the structure of the array that <span class="function"><strong>lstat()</strong></span> returns. This function is identical to the <span class="function"><a href="function.stat.html" class="function">stat()</a></span> function except that if the <em><code class="parameter">filename</code></em> parameter is a symbolic link, the status of the symbolic link is returned, not the status of the file pointed to by the symbolic link. </p> </div> <div class="refsect1 examples" id="refsect1-function.lstat-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2410"> <p><strong>Example #1 Comparison of <span class="function"><a href="function.stat.html" class="function">stat()</a></span> and <span class="function"><strong>lstat()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />symlink</span><span style="color: #007700">(</span><span style="color: #DD0000">'uploads.php'</span><span style="color: #007700">, </span><span style="color: #DD0000">'uploads'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Contrast information for uploads.php and uploads<br /></span><span style="color: #0000BB">array_diff</span><span style="color: #007700">(</span><span style="color: #0000BB">stat</span><span style="color: #007700">(</span><span style="color: #DD0000">'uploads'</span><span style="color: #007700">), </span><span style="color: #0000BB">lstat</span><span style="color: #007700">(</span><span style="color: #DD0000">'uploads'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents"><p> Information that differs between the two files. </p></div> <div class="example-contents screen"> <div class="cdata"><pre> Array ( [ino] => 97236376 [mode] => 33188 [size] => 34 [atime] => 1223580003 [mtime] => 1223581848 [ctime] => 1223581848 [blocks] => 8 ) </pre></div> </div> </div> </p> </div> <div class="refsect1 errors" id="refsect1-function.lstat-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Upon failure, an <strong><code>E_WARNING</code></strong> is emitted. </p> </div> <div class="refsect1 notes" id="refsect1-function.lstat-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">The results of this function are cached. See <span class="function"><a href="function.clearstatcache.html" class="function">clearstatcache()</a></span> for more details.</span></p></blockquote> <div class="tip"><strong class="tip">Tip</strong><p class="simpara">As of PHP 5.0.0, this function can also be used with <em class="emphasis">some</em> URL wrappers. Refer to <a href="wrappers.html" class="xref">Supported Protocols and Wrappers</a> to determine which wrappers support <span class="function"><a href="function.stat.html" class="function">stat()</a></span> family of functionality.</p></div> </div> <div class="refsect1 seealso" id="refsect1-function.lstat-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.stat.html" class="function" rel="rdfs-seeAlso">stat()</a> - Gives information about a file</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.linkinfo.html">linkinfo</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mkdir.html">mkdir</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>