fileatime

Gets last access time of file

Syntax

fileatime ( string $filename ) : int

Parameters

filename

Path to the file.

Return

Returns the time the file was last accessed, or FALSE on failure. The time is returned as a Unix timestamp.

Examples

1

<?

$filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt";

$return = fileatime($filename);

echo $return;

?>
1631588475

2

<?

$filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt";

$return = fileatime($filename);

echo "last accessed: " . date("Y-m-d H:i:s", $return);

?>
last accessed: 2021-09-14 03:01:15

Internal

filectime

filemtime

External

PHP

Home Menu