Something that nags me
Posted: Sun May 17, 2009 5:50 pm
Is there really any answer to this question?
Say you need to echo stuff in a loop
is it best to do this:
or this
To me the first way would be easier to code with since you wouldn't need to escape things.
Which would be faster or does it really matter?
Say you need to echo stuff in a loop
Code: Select all
foreach ($Array as $Data1 => $Data2)Code: Select all
foreach ($Array as $Data1 => $Data2) {
?>
<tr>
<td><?php echo $Data1; ?></td>
<td><?php echo $Data2; ?></td>
</tr>
<?php
}Code: Select all
foreach ($Array as $Data1 => $Data2) {
echo '
<tr>
<td>'.$Data1.'</td>
<td>'.$Data2.'</td>
</tr>
';
}Which would be faster or does it really matter?