Is it possible to extend the code to check multiple files in a directory and display the latest modification date automatically?

To extend the code to check multiple files in a directory and display the latest modification date automatically, you can loop through all the files in the directory using the `scandir()` function and then compare their modification dates to find the latest one. You can store the latest modification date and file name in variables and display them at the end of the loop.

$directory = "/path/to/directory/";
$latestFile = "";
$latestDate = 0;

$files = scandir($directory);
foreach ($files as $file) {
    if (is_file($directory . $file)) {
        $modifiedTime = filemtime($directory . $file);
        if ($modifiedTime > $latestDate) {
            $latestDate = $modifiedTime;
            $latestFile = $file;
        }
    }
}

echo "Latest modified file: " . $latestFile . "<br>";
echo "Last modified date: " . date("Y-m-d H:i:s", $latestDate);