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

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP filectime() Function Usage and Example

PHP Filesystem Reference Manual

The filectime() function returns the last modified time of the specified file. This function can check the daily modification of the file and the modification of the inode. Inode modification can refer to the modification of permissions, ownership, group, or other metadata. If successful, the function will return the last modified time of the file as a Unix timestamp. If it fails, it will return false.

Syntax

int filectime ( string $filename )

You can cache the result of this function and use clearstatcache() to clear the cache. We can use the filemtime() function to return the last modified time of the file content.

Online example

Use the filemtime() function to return the last modified time of the file content and format the time

<?php
   echo filectime("/PhpProject/sample.txt");
   echo "\n";
   echo "Last modification: ".date("Y-m-d H:i:s., filectime("/PhpProject/sample.txt"));
?>

Output result

1590217956
Last modification: 2020-05-23 09:12:36.

PHP Filesystem Reference Manual