How to use Filesystem fileatime in PHP

In this article I am going to explain about fileatime function in PHP.
  • 1154

PHP fileatime() function

The filesystem fileatime function is used to gets last access time of the specified file. It gives Unix timestamp on success and false on failure.

Syntax of fileatime function

fileatime(filename)

Parameters in fileatime function

It has only one parameter:

Parameter Description
filename It specifies the file to check.

Example of filesystem fileatime function

<html>

<body>

 

<?php

$filename = "C:\wamp\www\Dinesh\PhpIntro.txt";

if (file_exists($filename)) {

echo "$filename was last accessed: " .

date("F d Y H:i:s.", fileatime($filename));

}

?>

 

</body>

</html>


Output:

fileatimephp.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.