PHP Function Filemtime
The php function filemtime will return the time when the data blocks of a file were last modified. This is not the same as the last time the file was accessed, but can still be useful in a variety of situations. The time returned is a Unix timestamp, and can be formatted using the date() function for human-readable display. The result of this function is cached; use the clearstatcache() function to clear the cache.
Often you will want to know the time when a specific file was last updated. This can be for a variety of reasons, including visual printing of the last updated information (e.g. on frontpages of websites) or to select and delete files older than a specified number of days.
This snippet of code uses the filemtime function to get this information for all files on your website. It will even work with redirected pages, as it checks the time of the original file that was created on your server (file system independent).
Note: When checking timestamps, the resolution is limited to the second, so if a file was modified twice within the same second, it may appear that filemtime() did not find any change in the time stamp. This problem can be overcome by passing a epoch timestamp in the touch(file) call as the second argument.
For more information about php function filemtime, see the official documentation page. There is also a good article on this topic written by "dma05 at web dot de" from the Codewalkers site.