I've been finishing off a project for a client where the previous developer has put almost all of a pages HTML within ECHO's. I'm find it really difficult to navigation my way around the code.
I like to keep as much HTML as possible as HTML, this way, I can see DIV's and tables in dreamweaver, which makes amending layouts much easier. If you put a table or div with PHP code, it's really difficult to make changes as you can't visually see the DIV or tables when you're in dreamweaver.
Yesterday, I had a thought. PHP on the server parses everything between the PHP tags, so, the more PHP there is, the more code needs to be parsed, and surely this will have an effect on speed. On a small project I doubt you'd see much difference, however on a larger project where there essentially could be thousands of lines of additional code caused by HTML in ECHO's, it's going to have a bigger effect.
I wanted to test this for myself, and found a little script which starts a timer, and then ends it. I put some HTML and PHP code between the start and end of the timer.
The script looped 99999 times, and created a drop down item for each loop. I did one the way I like to code, and the other with HTML within PHP tags.
Now, this isn't conclusive evidence but, through all of my tests, the code with HTML within PHP ECHO's took longer to be generated on the server. Although there wasn't much difference in it (1000ms at most), there was a difference, and on a big project it could be wasted processor usage.
What I find puzzling as well is, if you put HTML within an ECHO, then you're using processor usage to echo out the HTML. When it gets to the browser, the browser uses processor usage to render the page. So essentially, you're parsing the same code twice....for no reason whatsoever, and with absolutely no benefit.
Save server resources and code correctly I say.