A note in the margin:
Is it possible to embed php-code in a .html page?
The answer is yes, but only by setting directives to the server; for example, through .htaccess:
AddHandler application/x-httpd-php .html .htm
or
AddHandler x-httpd-php5-cgi .html
PHP – an embeddable language, ie, in the php file not everything must be an executable php-code, there can be html, js, etc. Example:
<p>Эwill be ignored by PHP and displayed by the browser.</p>
<?php echo 'And this will be processed.'; ?>
<p>This too will be ignored by PHP and displayed by the browser.</p>
or
echo "Hello world";
// ... more code
echo "The last expression";
// The script ends here without the PHP closing tag
To get a better idea of how the interpreter works, here is an illustration:
We have a file where half of the text is in Russian and half in English. Our task is to translate all the text into Russian. Similarly, the interpreter looks at the .php file, which consists of html (Russian) and php-code (English; it must be processed, “translated”).