php-doc-en/reference/filesystem/functions/stat.xml

140 lines
4.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 -->
<refentry id="function.stat">
<refnamediv>
<refname>stat</refname>
<refpurpose>Gives information about a file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>stat</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
Gathers the statistics of the file named by
<parameter>filename</parameter>. If <parameter>filename</parameter>
is a symbolic link, statistics are from the file itself, not the
symlink. <function>lstat</function> is identical to <function>
stat</function> except it would instead be based off the symlinks
status.
</para>
<para>
In case of error, <function>stat</function> returns &false;. It also
will throw a warning.
</para>
<para>
Returns an array with the statistics of the file with the
following elements. This array is zero-based. In addition to
returning these attributes in a numeric array, they can be accessed
with associative indices, as noted next to each parameter; this is
available since PHP 4.0.6:
<itemizedlist>
<listitem>
<simpara>
0 : device (can also be accessed as <literal>dev</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
1 : inode (can also be accessed as <literal>ino</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
2 : inode protection mode (can also be accessed as <literal>mode</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
3 : number of links (can also be accessed as <literal>nlink</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
4 : user id of owner (can also be accessed as <literal>uid</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
5 : group id owner (can also be accessed as <literal>gid</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
6 : device type if inode device (can also be accessed as <literal>rdev
</literal>) *
</simpara>
</listitem>
<listitem>
<simpara>
7 : size in bytes (can also be accessed as <literal>size</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
8 : time of last access (can also be accessed as <literal>atime</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
9 : time of last modification (can also be accessed as <literal>mtime
</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
10 : time of last change (can also be accessed as <literal>ctime</literal>)
</simpara>
</listitem>
<listitem>
<simpara>
11 : blocksize for filesystem I/O (can also be accessed as
<literal>blksize</literal>) *
</simpara>
</listitem>
<listitem>
<simpara>
12 : number of blocks allocated (can also be accessed as
<literal>blocks</literal>)
</simpara>
</listitem>
</itemizedlist>
* - only valid on systems supporting the st_blksize type--other
systems (i.e. Windows) return -1.
</para>
&note.clearstatcache;
&note.no-remote;
<para>
See also <function>lstat</function>,
<function>filemtime</function>, and
<function>filegroup</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->