ThunderPoit, I would not get into the habit of throwing too much formatting into your PHP generated HTML output. It makes your PHP code a lot more difficult to read, browsers don't really care all that much for tabs and nice code layout and when you start using firebug, you won't really spend all that much time reading your own generated HTML anyway.
Here is a slight variation on your example, same thing just a different way to go about it...
[php]
$rows = array(
'row1' => array('col1', 'col2', 'col3'),
'row2' => array('col1', 'col2', 'col3')
);
echo "<table>\n";
foreach($rows as $rowname => $columns){
echo "<tr id=" . $rowname . ">";
foreach($columns as $value){
echo "<td>" . $value . "</td>";
}
echo "</tr>\n";
}
echo "</table>\n";
[/php]
should give you this...
Code:
<table>
<tr id=row1><td>col1</td><td>col2</td><td>col3</td></tr>
<tr id=row2><td>col1</td><td>col2</td><td>col3</td></tr>
</table>