php-doc-en/reference/filesystem/functions/stat.xml
Dave Barr 91e836093c - Standardize the Unix acronym. Unix is the preferred capitalization
as UNIX is a registered trademark by the Open Group. References to UNIX
  were left in where it made sense, like example outputs, and so forth.
  You can read the Trademark User Guide for "UNIX" at:
  http://www.unix.org/tmug2.ps or http://www.unix.org/tmug2.pdf


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@147067 c90b9560-bf6c-de11-be94-00142212c4b1
2003-12-21 04:22:00 +00:00

153 lines
4.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- 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:
</para>
<para>
<table>
<title><function>stat</function> and <function>fstat</function> result
format</title>
<tgroup cols="3">
<thead>
<row>
<entry>Numeric</entry>
<entry>Associative (since PHP 4.0.6)</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>dev</entry>
<entry>device number</entry>
</row>
<row>
<entry>1</entry>
<entry>ino</entry>
<entry>inode number</entry>
</row>
<row>
<entry>2</entry>
<entry>mode</entry>
<entry>inode protection mode</entry>
</row>
<row>
<entry>3</entry>
<entry>nlink</entry>
<entry>number of links</entry>
</row>
<row>
<entry>4</entry>
<entry>uid</entry>
<entry>userid of owner</entry>
</row>
<row>
<entry>5</entry>
<entry>gid</entry>
<entry>groupid of owner</entry>
</row>
<row>
<entry>6</entry>
<entry>rdev</entry>
<entry>device type, if inode device *</entry>
</row>
<row>
<entry>7</entry>
<entry>size</entry>
<entry>size in bytes</entry>
</row>
<row>
<entry>8</entry>
<entry>atime</entry>
<entry>time of last access (Unix timestamp)</entry>
</row>
<row>
<entry>9</entry>
<entry>mtime</entry>
<entry>time of last modification (Unix timestamp)</entry>
</row>
<row>
<entry>10</entry>
<entry>ctime</entry>
<entry>time of last change (Unix timestamp)</entry>
</row>
<row>
<entry>11</entry>
<entry>blksize</entry>
<entry>blocksize of filesystem IO *</entry>
</row>
<row>
<entry>12</entry>
<entry>blocks</entry>
<entry>number of blocks allocated</entry>
</row>
</tbody>
</tgroup>
</table>
* - only valid on systems supporting the st_blksize type--other
systems (i.e. Windows) return -1.
</para>
&note.clearstatcache;
&tip.fopen-wrapper.stat;
<para>
See also <function>lstat</function>,
<function>fstat</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
-->