What are the potential pitfalls of using echo tags in PHP for pagination links?

Using echo tags in PHP for pagination links can lead to messy and hard-to-read code, making it difficult to maintain and debug. To solve this issue, it is recommended to separate the HTML markup from the PHP logic by using alternative syntax like HEREDOC or concatenating strings.

<?php
// Example of using HEREDOC syntax for pagination links
$page = 1;
$totalPages = 10;

echo <<<HTML
<div class="pagination">
HTML;

for ($i = 1; $i <= $totalPages; $i++) {
    echo "<a href='?page=$i'>$i</a>";
}

echo <<<HTML
</div>
HTML;

?>