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 daily modifications of the file and inode modifications. Inode modifications can refer to permission modifications, owner modifications, group modifications, or other metadata modifications. 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 Modified: ".date("Y-m-d H:i:s.",filectime("/PhpProject/sample.txt");
?>

Output Result

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

PHP Filesystem Reference Manual