How can PHP be used effectively as a template language without a separate template engine?

Using PHP as a template language without a separate template engine can be achieved by separating the HTML structure from the PHP logic. This can be done by creating separate PHP files for the logic and including them in the main template file where the HTML structure is defined. By following this approach, you can maintain clean and readable code while leveraging the power of PHP for dynamic content generation.

<!-- main_template.php -->
<html>
<head>
    <title>Template Example</title>
</head>
<body>
    <header>
        <?php include 'header.php'; ?>
    </header>
    
    <main>
        <?php include 'content.php'; ?>
    </main>
    
    <footer>
        <?php include 'footer.php'; ?>
    </footer>
</body>
</html>
```

```php
<!-- header.php -->
<h1>Welcome to our website!</h1>
```

```php
<!-- content.php -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
```

```php
<!-- footer.php -->
<p>© 2021 My Website. All rights reserved.</p>