SplFileInfo::getATime
PHP function
Edit on GitHub ✎
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
Gets last access time of the file
Description
SplFileInfo::getATime(): int|false
Gets the last access time for the file.
Parameters Parameters
Return Values
Returns the time the file was last accessed on success, or false on failure.
Errors/Exceptions
Throws RuntimeException on error.
Examples
SplFileInfo::getATime example
php
<?php
$info = new SplFileInfo('example.jpg');
echo 'Last accessed at ' . date('g:i a', $info->getATime());
?>The above example will output something similar to:
output
Last accessed at 1:49 pmSee Also
fileatime()SplFileInfo::getCTimeSplFileInfo::getMTime