How can concatenation be used to properly display PHP variables retrieved from a database in HTML?

When displaying PHP variables retrieved from a database in HTML, concatenation can be used to properly format the output. This involves combining the HTML code with the PHP variables using the concatenation operator (.) to ensure that the variables are displayed correctly within the HTML structure.

<?php
// Assume $row is an array containing data retrieved from the database
echo '<div>';
echo '<p>Name: ' . $row['name'] . '</p>';
echo '<p>Email: ' . $row['email'] . '</p>';
echo '</div>';
?>