PHP | filectime() Function

PHP filectime() Function


Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP filectime() Function.

The 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 simply refers to the modification of authority, owner, user group or modification of metadata.

Syntax

Following below is the syntax to use this function -

int filectime ( string $filename )


The result of this built-in PHP function can be cached, and the clearstatcache() can be used to clear the cache. The filemtime() can be used to return the last modification time of the file content.

Return Value

It returns the last modification time of a file as a Unix timestamp if successful, else it is going to return false if it fails.

Example

Try out the below example -

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

Output

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

1590217956
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.