In most Unix file systems, the modification time and the change time of a file may not necessarily be the same, they are actually 2 very distinct concepts to deal with:
- File modification time represents when the data blocks or content are changed or modified, not including that of meta data such as ownership or ownergroup.
- File change time represents the time when the meta data or inode data of a file is altered, such as the change of permissions, ownership or group.
Accordingly, PHP function filemtime() returns the time the content is modified or updated while function filectime() returns the time when the meta data is updated or changed.
When you need to display a web page last modification time, for example, you should use filemtime() because you want to show the time when the page content is updated.
Related Posts
- Linux: The differences between file times: atime (accessed time), ctime (changed time) and mtime (modified time).
- PHP: Getting Last Changed Time of a File – File ctime
- PHP: Getting Last Modification Time of a File – File mtime
- Use stat command to display file system meta information of any file or directory under Linux
- PHP: Create a Temporary File
