Benefits of first one
- Easier to read
- ???
Benefits of second one
- WYSIWYG is possible
- HTML Code Completion/Tag-Matching possible with some IDEs
- No escaping headaches
- Easier for larger chunks of HTML
If I have a lot of HTML in a given PHP routine (like an MVC view) then I definitely use the 2nd method. But I format it differently – I strictly rely on the tag-like nature of PHP’s demarcations, i.e., I make the PHP sections look as much like HTML tags as I can
<table>
<?php foreach($lotsofrows as $row) { ?>
<tr>
<td><?php echo $row['id']; ?></td>
</tr>
<?php } ?>
</table>