Re: Newbie needs recommendation for fast learning a little php.

Arno Welzel <[email protected]> Wed, 30 Jun 2021 15:09:57 +0200
Newsgroups comp.lang.php,alt.comp.lang.php,alt.php
Message-ID <[email protected]>
[email protected]:

> This does what I want, but only as a .PHP file. How do I get it into a
> file named foo.html so I can have foo.html declare when it was last
> modified?
> 
> <?php
> $file = $_SERVER["SCRIPT_NAME"];
>     $break = Explode('/', $file);
>     $pfile = $break[count($break) - 1]; 

Why this?

> //echo $pfile;
> echo "This file was last modified on: " .date("Y-m-d
> H:m",filemtime($pfile));
> ?>
> 
> I feel as if I'm almost there.

Much simpler:

<?php
echo "This file was last modified on: ";
echo date("Y-m-d H:m",filemtime($_SERVER["SCRIPT_FILENAME"]));
?>

Also see:

<https://www.php.net/manual/en/reserved.variables.server.php>

"'SCRIPT_FILENAME'

The absolute pathname of the currently executing script."


-- 
Arno Welzel
https://arnowelzel.de