Is it considered a best practice to embed HTML blocks directly within PHP scripts, or is it recommended to separate them using includes?

It is generally considered a best practice to separate HTML blocks from PHP scripts using includes. This helps to improve code readability, maintainability, and reusability. By separating the HTML code into separate files, it also makes it easier to make changes to the layout without having to modify the PHP logic.

<?php
// Separate HTML block into a separate file
include 'header.php';

// PHP logic here

include 'footer.php';
?>