PHP Tutorial - PHP filectime() Function






Definition

The filectime() function returns the last time the specified file was changed, including changes to permissions, owner, group or other metadata.

Syntax

PHP filectime() Function has the following syntax.

filectime(filename)

Parameter

ParameterIs RequiredDescription
filenameRequired.File to check

Note

The result of this function are cached. Use clearstatcache() to clear the cache.

Use the filemtime() function to return the last time the file content was changed.





Return

This function returns the last change time as a Unix timestamp on success, FALSE on failure.

Example

Get the last change time for a file


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

The code above generates the following result.