• PHP Video Tutorials

PHP - Function filemtime()



The filemtime() function can return the last time file content was modified. This function can return the last change time as Unix timestamp on success or false on failure.

Syntax

int filemtime ( string $filename )

This function can return time when the data blocks of a file written to, that is, the time when the content of the file has changed.

Example

<?php
   echo filemtime("/PhpProject/sample.txt"); 
   echo "\n";
   echo "Last modified: ".date("F d Y H:i:s.",filemtime("/PhpProject/sample.txt"));
?>

Output

1590392449
Last modified: May 25 2020 09:40:49.
php_function_reference.htm
Advertisements