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