PHP fileatime() Function

❮ PHP Filesystem Reference

Example

Get last access time of "webdictionary.txt":

<?php
echo fileatime("webdictionary.txt");
echo "<br>";
echo "Last access: ".date("F d Y H:i:s.", fileatime("webdictionary.txt"));
?>
Run Example »

Definition and Usage

The fileatime() function returns the last access time of the specified file.

Note: The result of this function is cached. Use clearstatcache() to clear the cache.

Note: The atime of a file changes each time the data of a file are being read. This can decrease the performance if an application accesses a  large number of files or directories. Some Unix systems have access time updates disabled to increase performance. In this case this function is useless.

Syntax

fileatime(filename)

Parameter Values

Parameter Description
filename Required. Specifies the path to the file to check


Technical Details

Return Value: The last access time as a Unix timestamp on success, FALSE on failure
PHP Version: 4.0+

❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.