What is the correct syntax for retrieving the modification date of files in a directory using filemtime in PHP?

To retrieve the modification date of files in a directory using filemtime in PHP, you need to use the filemtime function along with the glob function to loop through all files in the directory. The filemtime function returns the Unix timestamp of the last modification time of the file. You can then use the date function to format this timestamp into a readable date format.

$files = glob('/path/to/directory/*');

foreach ($files as $file) {
    $modification_date = date("Y-m-d H:i:s", filemtime($file));
    echo "File: $file | Modification Date: $modification_date <br>";
}