What are the potential pitfalls of trying to embed a PHP counter in a pure HTML page?

Embedding a PHP counter in a pure HTML page can lead to the PHP code not being executed properly because the server needs to interpret PHP code, which is not possible in a static HTML file. To solve this issue, you can save the HTML file with a .php extension, allowing the server to parse and execute the PHP code within the file.

<!DOCTYPE html>
<html>
<head>
    <title>PHP Counter</title>
</head>
<body>
    <h1>Visitor Count: <?php echo $counter; ?></h1>
</body>
</html>