Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

fileatime()

Example

Retrieve the 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”));
?>

Definition and Usage

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

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

 

Note: The access time (atime) of a file changes each time the file’s data is read. This can reduce performance if an application accesses a large number of files or directories. Some Unix systems disable access time updates to improve performance, making this function ineffective in those cases.

Syntax

fileatime(filename)

Parameter Values

Parameter

Description

filename

Mandatory. Specifies the path to the file to check.

Technical Details

 

Return Value:

Returns the last access time as a Unix timestamp on success, or FALSE on failure.

PHP Version:

4.0+