I separate my code (not limited to PHP) from HTML in one of 2 ways:
1) use of includes (e.g. require_once()):
<?php require_once('header.php'); ?>
<table>
<tr>
<td>
Hello Nairaland!!
</td>
</tr>
</table>
<?php require_once('footer.php'); ?>
2) beginning my code tabbed over once from the line and my HTML tabbed over 2ce from the line. In other words, take PHP for example:
<?php
$uri = $_SERVER['REQUEST_URI']; //to obtain what comes after
www.nairaland.com in address bar above
if(strchr($uri, "topic=35738") { //does the uri contain the string, "topic=35738"?
?>
<table>
<tr>
<td>
Hello Nairaland!!
</td>
</tr>
</table>
<?php
} else {
?>
<table>
<tr>
<td>
Hello Nigeriaworld!!
</td>
</tr>
</table>
<?php
}//if
?>
Of course, for #2, I could hv printed out the strings without using tables. I just wanted to illustrate indentation

I hope this helps