English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP filemtime() Function Usage and Example

PHP Filesystem Reference Manual

The filemtime() function returns the time when the file content was last modified. This function can return the last modification time in the form of a Unix timestamp if successful, and return false if it fails.

Syntax

int filemtime ( string $filename )

When writing blocks of data to a file, this function can return the time, that is, the time when the file content was changed.

Online Example

<?php
   echo filemtime("sample.txt"); 
   echo "\n";
   echo "Last Modified: ".date("F d Y H:i:s.",filemtime("/PhpProject/sample.txt");
?>
Test and See‹/›

Output Result

1590392449
Last Modified: May 25 2020 09:40:49.

PHP Filesystem Reference Manual