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, false is returned.

Syntax

filemtime(filename)
Parameter Description
filename Required. Specifies the file to be checked.

Description

This function returns the last modified time of the data block in the file, that is, the last time the file content 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.