What are the advantages of using HEREDOC for storing HTML code in PHP functions?

Using HEREDOC for storing HTML code in PHP functions allows for cleaner and more readable code by separating the HTML content from the PHP logic. It also makes it easier to maintain and update the HTML content without having to worry about escaping quotes or concatenating strings. Additionally, HEREDOC syntax supports variables interpolation, making it convenient to inject dynamic data into the HTML content.

function generate_html_content($title, $content) {
    $html = <<<HTML
        <div class="container">
            <h1>$title</h1>
            <p>$content</p>
        </div>
    HTML;

    return $html;
}

echo generate_html_content("Welcome", "This is some dynamic content.");