Get the dynamic time of the last file change

I made several unsuccessful attempts. I want to get the last modified time of a file, from the current file - that is, the file being viewed. The following code works for employeeer.es.php, but I will reuse it in other files if I do not change the file names.

<?php // make var from file name $last_modified = filemtime("employer.es.php"); // print date echo "Information last modified on " . date("m/d/Y", $last_modified); ?> 

So instead of entering a file name in each file, I want it to use the current file. I hope I have a point: / Thank you!

+4
source share
1 answer

The magic constant __FILE__ should help you here.

$last_modified = filemtime(__FILE__);

+7
source

All Articles