★ wanayoo — archive 1999 http://uk.php.net/manual/sv/function.stat.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<set_file_buffersymlink>
view the version of this page
Last updated: Thu, 24 Apr 2003

stat

(PHP 3, PHP 4 )

stat -- Gives information about a file

Description

array stat ( string filename)

Gathers the statistics of the file named by filename. If filename is a symbolic link, statistics are from the file itself, not the symlink. lstat() is identical to stat() except it would instead be based off the symlinks status.

In case of error, stat() returns FALSE

Returns an array with the statistics of the file with the following elements:

  1. device

  2. inode

  3. inode protection mode

  4. number of links

  5. user id of owner

  6. group id owner

  7. device type if inode device *

  8. size in bytes

  9. time of last access

  10. time of last modification

  11. time of last change

  12. blocksize for filesystem I/O *

  13. number of blocks allocated

* - only valid on systems supporting the st_blksize type--other systems (i.e. Windows) return -1.

Not: The results of this function are cached. See clearstatcache() for more details.

Not: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.

See also lstat(), filemtime(), and filegroup().



User Contributed Notes
stat
add a note add a note
ian at eiloart dot com
23-Jul-1999 02:52

Here's what the UNIX man page on stat has to say about the difference between a file change and  a file modification:

st_mtime  Time when data was last modified.  Changed by  the following  functions:   creat(),  mknod(), pipe(), utime(), and write(2).

st_ctime  Time when file status was last  changed.   Changed by  the  following functions: chmod(), chown(), creat(), link(2), mknod(), pipe(), unlink(2), utime(), and write().

So a modification is a change in the data, whereas a change also happens if you modify file permissions and so on.

ngreen at neilsmachine dot com
11-Nov-2000 07:00

When you get a time from stat, like the date modified, you'll get a timestamp returned.  You can use date() to convert it into a human readable format:

$modified = stat("yourfile.html");
echo date("l, F dS",$modified[9]);

add a note add a note

<set_file_buffersymlink>
 Last updated: Thu, 24 Apr 2003
show source | credits | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: Kewlio.net Limited
Last updated: Sat Jun 7 04:10:06 2003 BST