What PHP function can be used to determine the last modification time of a file?
To determine the last modification time of a file in PHP, you can use the `filemtime()` function. This function returns the Unix timestamp of when the file was last modified. You can use this timestamp to format the date and time according to your needs.
$filename = 'example.txt';
$lastModifiedTime = filemtime($filename);
echo "Last modified time of $filename: " . date("Y-m-d H:i:s", $lastModifiedTime);
Keywords
Related Questions
- How can one optimize the use of ORDER BY RAND() in PHP when dealing with a large number of database records?
- How can PHP handle XML files with multiple instances of the root element?
- How can PHP developers ensure that the data retrieved from a Facebook page is displayed accurately and securely on their website?