The filemtime()
function is a built-in function in PHP. It returns the time when any specified file contents were last modified by the user.
filemtime($filename)
$filename
: The file we want to check to determine when it was last modified.
This method returns a Unix timestamp denoting the last modified time. It returns False
if the function does not execute successfully.
Let’s look at the code, which determines when the contents of hello.txt
were last modified:
<?php// Checking last modified time of fileecho filemtime("hello.txt");echo "\n";// formatting the data in data and time formatecho "Checking last modified time of file: ".date("F d Y H:i:s.",filemtime("hello.txt"));?>
Free Resources