How can the PHP interpreter be properly triggered in a file that contains both HTML and PHP code?

To properly trigger the PHP interpreter in a file that contains both HTML and PHP code, you need to ensure that the file has a .php extension and that the PHP code is enclosed within <?php ?> tags. This allows the interpreter to recognize and execute the PHP code embedded within the HTML.

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;PHP Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;Today&#039;s date is: &lt;?php echo date(&#039;Y-m-d&#039;); ?&gt;&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;