Which is better in terms of CPU optimization for a web server? Writing plain HTML and inserting PHP code here and there?
<script type="text/javascript">$(document).ready(function(){$('#search').focus();});</script>
<div id="default">
<div class="left">
<?include(DIR_DIV.'facebook.php')?>
</div>
<div class="right">
<?include(DIR_ADS.'google.300x250.php')?>
</div>
<div class="sep"></div>
</div>
Or writing the all the HTML with echo in PHP?
echo '<script type="text/javascript">$(document).ready(function(){$(\'#search\').focus();});</script>';
echo '<div id="default">';
echo '<div class="left">';
include(DIR_ADS.'google.300x250.php');
echo '</div>';
echo '<div class="right">';
include(DIR_DIV.'facebook.php');
echo '</div>';
echo '<div class="sep"></div>';
echo '</div>'
Does the difference even matter or is it insignificant?
finally, does the difference even matter or is it insignificant?
It doesn't matter performance wise, it's completely insignificant.
It does matter readability wise though - I find the first block far more legible than the second one. Wrapping HTML into PHP code like that doesn't make sense - it becomes harder to debug, for one thing.