Some PHP code

(This page SomePHP.md was last edited on 2022-04-28 02:47 PM)

This is a demo of a few bits of embedded PHP. Do Ctl-U to view source code and try to find any .php code. (Hint, there isn't because PHP code is executed on the web server before it gets to you.)

But look at the Frogdown source code: SomePHP.text (which is really a copy of SomePHP.md) to see the embedded PHP code. You can also examine SomePHP.php with nano in your web server's DocumentRoot directory. At this point the web server hasn't executed the PHP code.

First a quick validity test that PHP works.

This was printed by PHP. Still in PHP. The PHP code defined a PHP $Filename variable that is defined as: Frogdown.zip

Now we are out of PHP and back in regular HTML. Now we'll use a PHP function to find when Frogdown.zip was last modified. (Actually the preceding sentence went into PHP to print the value of the $Filename variable. Which isn't a variable in regular HTML. You don't need to break out %save% for short inline PHP code. Only for longer multi-like PHP that has blank lines.)

Frogdown.zip was last modified (zipped) on April 28, 2022 02:41 pm EDT

This page (SomePHP.php) was last modified (generated) on April 28, 2022 02:47 pm EDT

SomePHP.php was generated by Frogdown so it will (probably) have a different modification date than SomePHP.md (which was modified (edited) on 2022-04-28 02:47 PM))

Then we'll use PHP to find out how large Frogdown.zip is.

Frogdown.zip is 2.8 megabytes long.

And we are back to regular HTML.