PHP » I/O » stat()

Syntax:
array stat(string filename)
filename
The name of the file.

Returns information about a file.

stat() returns an indexed array with information about a file: device, inode, inode protection mode, number of links, owner id, owner group id, inode device type, file size, last access, last modification, last change, filesystem block size, number of blocks allocated. If an error occurs, FALSE is returned.

Examples

Code:
<?php

$fileinfo = stat("stat.php");
print "File size: $fileinfo[7]<br>";
print "Block size: $fileinfo[11]<br>";
print "Number of allocated blocks: $fileinfo[12]";

?>
Output:
File size: 254
Block size: 4096
Number of allocated blocks: 8
Explanation:

Using stat(), some information is printed about a file.

See Also: