Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP filemtime() Function

PHP filemtime() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

The filemtime() function returns the time when the file contents were last modified.

Returns the last modification time of the file contents as a Unix timestamp on success, or FALSE on failure.

Syntax

filemtime(filename)

Parameters Description
filename Required. Specifies the file to check.

Tips and Notes

**Note:** The results of this function are cached. Use clearstatcache() to clear the cache.


Example

"; echo "Last modified: ".date("F d Y H:i:s.",filemtime("test.txt")); ?>

The code above will output:

1139919766

Last modified: February 14 2006 13:22:46.


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual