What is the filectime() function in PHP?

The filectime() function is a built-in function in PHP. It returns the time when any specified file was last changed by the user, particularly its inode data.

Inode data refers to permissions, owner, group, or other metadata. When any of these items are updated, it is considered a change to the file.

Syntax

filectime($filename)

$filename: The file we want to check to determine the time it was last changed.

Return value

This method returns a Unix timestamp denoting when the file was last changed. Otherwise, it returns False.

Code

Let’s look at the code, which prints when the file hello.txt was last changed:

main.php
hello.txt
<?php
// Checking last modified time of file
echo filectime("hello.txt");
echo "\n";
// formatting the data in data and time format
echo "Checking when was file last changed: ".date("F d Y H:i:s.",
filectime("hello.txt"));
?>

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved