Hi,
This may be a silly question, but as someone relatively new to PHP, I'm wondering if there are any performance-related issues to frequently opening and closing PHP tags in HTML template code, and if so, what might be best practices in terms of working with php tags?
My question is not about the importance/correctness of closing tags, or about which type of code is more readable than another, but rather about how the document gets parsed/executed and what impact it might have on performance.
To illustrate, consider the following two extremes:
Mixing PHP and HTML tags:
<?php echo
'<tr>
<td>'.$variable1.'</td>
<td>'.$variable2.'</td>
<td>'.$variable3.'</td>
<td>'.$variable4.'</td>
<td>'.$variable5.'</td>
</tr>'
?>
// PHP tag opened once
Separating PHP and HTML tags:
<tr>
<td><?php echo $variable1 ?></td>
<td><?php echo $variable2 ?></td>
<td><?php echo $variable3 ?></td>
<td><?php echo $variable4 ?></td>
<td><?php echo $variable5 ?></td>
</tr>
// PHP tag opened five times
Would be interested in hearing some views on this, even if it's just to hear that it makes no difference.
Thanks.