Home > Article > Backend Development > PHP filemtime() function_PHP tutorial
Definition and Usage
The filemtime() function returns the last modification time of the file content.
If successful, the time is returned as a Unix timestamp. On failure, returns false.
Grammar
filemtime(filename)
Parameters
Description
filename Required. Specifies the documents to be checked.
Description
This function returns the time when the data block in the file was last written, that is, the time when the content of the file was last modified.
Tips and Notes
Tip: The result of this function will be cached. Please use clearstatcache() to clear the cache.
Example
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.