PHP filemtime() function
Definition and Usage
The filemtime() function returns the last modification time of the file content.
If successful, the time is returned in the form of a Unix timestamp. If failed, it returns false.
Syntax
filemtime(filename)
Parameter | Description |
---|---|
filename | Required. Specifies the file to be checked. |
Description
This function returns the last time the data block in the file was written, that is, the last time the content of the file was modified.
Tips and Comments
Tip:The result of this function will be cached. Please use clearstatcache() to clear the cache.
Example
<?php echo filemtime("test.txt"); echo "Last modified: ".date("F d Y H:i:s.",filemtime("test.txt")); ?>
Output:
1139919766 Last modified: February 14 2006 13:22:46.