What are some common methods for generating dynamic HTML pages in PHP?

One common method for generating dynamic HTML pages in PHP is to use the echo statement to output HTML code mixed with PHP variables and functions. Another approach is to use PHP's heredoc syntax to create multi-line strings containing HTML code. Additionally, PHP frameworks like Laravel or Symfony provide tools and templates for generating dynamic HTML pages efficiently.

<?php
// Using echo statement to output dynamic HTML
$name = "John";
echo "<h1>Welcome, $name!</h1>";

// Using heredoc syntax for multi-line HTML strings
$message = "Hello, $name!";
$html = <<<HTML
<div>
    <p>$message</p>
</div>
HTML;

echo $html;
?>