PHP lstat()
Function
Definition and Usage
The lstat()
function returns information about a file or symbolic link.
The function returns an array containing 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 of file in bytes
[8] or [atime] - Last access time (Unix timestamp)
[9] or [mtime] - Last modification time (Unix timestamp)
[10] or [ctime] - Last inode change time (Unix timestamp)
[11] or [blksize] - Block size for filesystem I/O (if supported)
[12] or [blocks] - Number of blocks allocated
Syntax
Parameter | Description |
---|---|
file | Required. Specifies the path to check. |
Tips and Notes
Note: The results returned by this function may differ between servers. This array contains numeric indices, named indices, or both.
Note: The results of this function are cached. Use clearstatcache()
to clear the cache.
Tip: The lstat()
function is similar to the stat()
function. The only difference is that if the file
parameter is a symbolic link, it returns the status of the symbolic link itself (rather than the status of the file it points to).
Example
The above code will output: