What is the function of filemtime() in PHP and how can it be used to determine the creation date of a directory?
The filemtime() function in PHP is used to get the last modified time of a file. To determine the creation date of a directory, you can use the filemtime() function on the directory itself. However, note that the creation date of a directory is not directly stored in most file systems, so the last modified time is typically used as an approximation.
$directory = 'path/to/your/directory';
if (is_dir($directory)) {
$creation_time = filemtime($directory);
echo "Creation time of directory: " . date("Y-m-d H:i:s", $creation_time);
} else {
echo "Not a valid directory";
}