The filectime() function in PHP is an inbuilt function which is used to return the last time the specified file was changed. The filectime() function returns the last time the file was changed as a Unix Timestamp on success and False on failure. The filectime() function checks for inode changes which are the updations in permissions, owner, group or other metadata as well as regular changes.
The filename is passed as a parameter to the filectime() function. The result of the filectime() function is cached and a function called clearstatcache() is used to clear the cache.
Parameters: The filectime() function in PHP accepts only one parameter $filename. It specifies the file whose last changed time you want to check.
Return Value: It returns the last changed time of a file as a Unix Timestamp on success and False on failure.
Errors And Exception:
- The time resolution may differ from one file system to another.
- This function doesn’t works on some unix systems which have access time updates are disabled to increase performance.
Input : echo filectime("gfg.txt"); Output : 1525159574 Input : echo "Last changed: ".date("F d Y H:i:s.", filectime("gfg.txt")); Output : Last changed: May 1 2018 07:26:14.
Below programs illustrate the filectime() function.
1525159574 Last changed: May 1 2018 07:26:14.
- How to get the function name inside a function in PHP ?
- PHP | min( ) Function
- PHP | dir() Function
- D3.js | d3.lab() Function
- CSS | rgb() Function
- p5.js | value() Function
- p5.js | int() function
- p5.js | box() Function
- D3.js | d3.hcl() Function
- D3.js | d3.min() function
- D3.js | d3.map.set() Function
- PHP | max( ) Function
- PHP | Ds\Map get() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.