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

[email protected] Wed, 30 Jun 2021 13:46:35 -0400
Newsgroups comp.lang.php,alt.comp.lang.php,alt.php
Organization Newshosting.com - Highest quality at a great price! www.newshosting.com
Message-ID <[email protected]>
On Wed, 30 Jun 2021 15:09:57 +0200, Arno Welzel <[email protected]>
wrote:

>[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?

Why the one below here? I'm casting about trying to find something
that works. I'm picking up what I can. I'm pretty much flailing about
at this point.

>> //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"]));
>?>

Thanks for that. I've plugged this in and saved it as foo.php and I
get an odd reaction. The actual time stamp on the file is 13:22, but
the above script is telling me that the file was last modified at
13:06. I suppose that the idiots at my Web host may have screwed up
something on the server. The 13:22 time is when I created the file, so
it can't be that it's showing when it was created and not when it was
modified. I'm scratching my head here.

>Also see:
>
><https://www.php.net/manual/en/reserved.variables.server.php>
>
>"'SCRIPT_FILENAME'
>
>The absolute pathname of the currently executing script."

Okay, I don't understand what you mean in the piece immediately above
this. The above url seems to say that the script will just run.