Stat() Function

Stat() Function

The stat() function returns information about a file.

This function returns an array with the following elements:

[0] or [dev] - Device number

[1] or [ino] - Inode number

[2] or [mode] - Inode protection mode

[3] or [nlink] - Number of links

[4] or [uid] - User ID of owner

[5] or [gid] - Group ID of owner

[6] or [rdev] - Inode device type

[7] or [size] - Size in bytes

[8] or [atime] - Last access (as Unix timestamp)

[9] or [mtime] - Last modified (as Unix timestamp)

[10] or [ctime] - Last inode change (as Unix timestamp)

[11] or [blksize] - Blocksize of filesystem IO (if supported)

[12] or [blocks] - Number of blocks allocated

Example:

<?php

$stat = stat(”sample.txt”);

print_r($stat);

?>

Output:

Array ( [0] => 4 [1] => 0 [2] => 33206 [3] => 1 [4] => 0 [5] => 0 [6] => 4 [7] => 13 [8] => 1173153669 [9] => 1172570432 [10] => 1172570425 [11] => -1 [12] => -1 [dev] => 4 [ino] => 0 [mode] => 33206 [nlink] => 1 [uid] => 0 [gid] => 0 [rdev] => 4 [size] => 13 [atime] => 1173153669 [mtime] => 1172570432 [ctime] => 1172570425 [blksize] => -1 [blocks] => -1 )

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.