Write a PHP script to get last modified information of a file.

basename() function: The basename(path,suffix) function is used to get the filename from a path.

filemtime() function: The filemtime(filename) function is used to get the last time the file content was modified.

php code:

<?php
$file = basename($_SERVER['PHP_SELF']);
$last = filemtime($file); 
echo "Last modified " . date("l, dS F, Y, h:ia", $last)."\n";
?>

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post