Everything works fine when I try and do this.
echo date("F d, Y h:i:s A",filemtime("index.php"));
But when I try to run a code like this.
date_default_timezone_set('America/Chicago');
$name = $_SERVER['PHP_SELF'];
$name = basename("$name", "").PHP_EOL;
echo date("F d, Y h:i:s A",filemtime("$name"));
I get this garbage…
Warning: filemtime() [function.filemtime]: stat failed for index.php in C:\xampp\htdocs\newsite \footer.php on line 9
December 31, 1969 06:00:00 PM
I see no difference.
The difference is the
PHP_EOL. Your filenameindex.phpdoes not end in a linebreak. Try removing thePHP_EOLconcatenation:By the way, you do not need to surround your variables in double quotes.