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.
<!DOCTYPE html>
<html>
<head>
<title>PHP Example</title>
</head>
<body>
<h1>Today's date is: <?php echo date('Y-m-d'); ?></h1>
</body>
</html>