PHP | filectime() Function

PHP filectime() Function

Hello dear readers! welcome back to another edition of our tutorial on PHP. In this tutorial guide, we are going to be discussing about the PHP filectime() Function.

The built-in PHP filectime() function returns the last modification time of the specified file. This function can check the daily modification of a file and also the modification of inode.

The inode modification can simply refer to a modification of authority, owner, user group or modification of metadata.


Following below is the syntax to use this function -

int filectime ( string $filename )

The result of this function can be cached, and the clearstatcache() can be used to clear the cache. We can use the filemtime() to return the time when the file content was last modified.

Return Value

This built-in PHP function returns the last modification time of a file as a Unix timestamp if successful, otherwise it returns false if it fails.


Try out the below example -

   echo filectime("/PhpProject/sample.txt");
   echo "\n";
   echo "Last change: ".date("F d Y H:i:s.",filectime("/PhpProject/sample.txt"));


When the above code is executed, it will produce the following result -

Last change: May 23 2020 09:12:36.

Alright guys! This is where we are rounding up for this tutorial guide. In our next tutorial guide, we are going to be discussing about the PHP filegroup() Function.

Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.