How can PHP be used to retrieve the creation date of a folder?
To retrieve the creation date of a folder in PHP, you can use the `filectime()` function which returns the inode change time of a file. This time represents the last time the file's inode data was changed, which includes the creation time for folders on most systems. By using this function, you can retrieve the creation date of a folder in PHP.
$folderPath = 'path/to/folder';
if (file_exists($folderPath)) {
$creationDate = date("Y-m-d H:i:s", filectime($folderPath));
echo "The creation date of the folder is: " . $creationDate;
} else {
echo "Folder does not exist.";
}
Keywords
Related Questions
- How can PHP developers ensure that variables are properly maintained and accessible across script instances?
- What are the potential issues with using reserved keywords like "password" in PHP code and how can they be addressed?
- How does Alternative PHP Cache (APC) differ from traditional PHP accelerators in terms of code protection?