Check if file has been modified

filemtime() function

<?php
$file_path = 'example.txt';

$file_modified_time = filemtime($file_path);
$current_time = time();

if ($file_modified_time > $current_time - 3600) {
    echo "The file has been modified within the last hour.";
} else {
    echo "The file has not been modified within the last hour.";
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *