PHP streamWrapper stream_stat() Method
The PHP streamWrapper::stream_stat() method retrieves information about a file resource. This method is called in response to fstat() function.
Syntax
public streamWrapper::stream_stat()
Parameters
No parameter is required.
Return Value
In case of error, returns false, otherwise returns an array with the following elements:
Numeric | Associative | Description |
---|---|---|
0 | dev | device number |
1 | ino | inode number |
2 | mode | inode protection mode |
3 | nlink | number of links |
4 | uid | userid of owner |
5 | gid | groupid of owner |
6 | rdev | device type, if inode device |
7 | size | size in bytes |
8 | atime | time of last access (Unix timestamp) |
9 | mtime | time of last modification (Unix timestamp) |
10 | ctime | time of last inode change (Unix timestamp) |
11 | blksize | blocksize of filesystem IO |
12 | blocks | number of 512-byte blocks allocated |
The value of mode contains information read by several functions. When written in octal, starting from the right, the first three digits are returned by chmod(). The next digit is ignored by PHP. The next two digits indicate the file type. For example a regular file could be 0100644 and a directory could be 0040755.
mode file types
mode in octal | Description |
---|---|
0140000 | socket |
0120000 | link |
0100000 | regular file |
0060000 | block device |
0040000 | directory |
0020000 | character device |
0010000 | fifo |
Note: As PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
Exceptions
Emits E_WARNING if call to this method fails (i.e. not implemented).
❮ PHP Streams Reference