Information functions

When scripts for server maintenance or, for example, analyzing the file system, it is necessary to obtain information about a particular file. PHP offers a whole set of functions that return data on file with the specified path. I think it is best punch.RPK Tramplin

Information functions
fileatime ($filename)
returns the last reading of the file; this time is returned as a timestamp
filectime ($filename)
returns the last modification time and inode (only Unix) format timestamp
filemtime ($filename)
returns the last modification timestamp format
fileowner ($filename)
returns the ID of the user who owns the file
filegroup ($filename)
returns the ID of the group to which the file (Unix only)
fileinode ($filename)
returns the inode number which is assigned to the file (Unix only)
fileperms ($filename)
returns the right of access to the file
filesize ($filename)
returns the file size in bytes
filetype ($filename)
returns the file type (UNIX systems only); possible types are „fifo”, „char”, „dir”, „block”, „link”, „file”, „unknown” for the appropriate queue fifo, character devices, directories, block devices, links, normal files and unknown types
stat ($filename)
This function returns an array containing the full information on file. Another indexes include:

• unit
• i-node
• protection mode i-node
• the number of links
• id owner
• id group
• the type of device if the device is based on the i-nodes
• size in bytes
• last access time
• last modification time and inode
• time of last change
• block size
• number of blocks
If this function is called on a symbolic link, this information will be related to the file, which indicates the link. For information about the link file itself, use lstat () (returned values are the same as for the stat ())

The logic functions (return true or false)
is_dir ($filename)
if a file with a given path is a directory
is_executable ($filename)
if the file is executable
is_file ($filename)
if the file is a normal file
is_link ($filename)
if the file is a link
is_readable ($filename)
if the file can be read
is_writable ($filename)
if the file can be written
is_uploaded_file ($filename) – whether the file was uploaded with form

Cookies help us deliver our services. By using our services, you agree to our use of cookies. More Info | Close