Embedded HTML versus echo or print
Posted: Fri Oct 24, 2003 9:39 am
I have a question that I believe I read something on this at one point but I can't recall where.
My question really is in regards to speed/optimization of the code rather than a style issue. (But style comments are wanted also
)
What is better in terms of optimization in these two different code blocks:
And
In the second case does the PHP interpretter just ignore the break and continue processing the rest of the code? Essentially leaving the HTML alone and moving passed it without causing any CPU/Mem hit?
Obviously if you have a lot of case 1 versus case 2 you actually spending more time processing function calls, but is there anywhere anyone knows of that documents this information? Anyone have any ideas?
Thanks for any help on this!
Matt
My question really is in regards to speed/optimization of the code rather than a style issue. (But style comments are wanted also
What is better in terms of optimization in these two different code blocks:
Code: Select all
<?php
if (1) {
echo "<H1>Hello World.</H1>";
}
?>Code: Select all
<?php
if (1) {
?>
<H1>Hello World.</H1>
<?php
}
?>Obviously if you have a lot of case 1 versus case 2 you actually spending more time processing function calls, but is there anywhere anyone knows of that documents this information? Anyone have any ideas?
Thanks for any help on this!
Matt