In terms of performance , what would be better. Using PHP to echo all the HTML output so I can pepper it with the various bits of working code and variables or escape HTML t
It falls into the realm of micro optimizations. The largest part of your time falls into initializing the PHP engine starting the work.
So unless you have an order of tens of thousands of lines (or even more), you shouldn't be concerned with it.
To add, i did a small test of a million lines where i used php to print them and where i used php to call a c program that did the same thing and the difference was minuscule.
A little more info.
What is happening in the 2nd example is that you are "turning on/off" PHP, its not exactly what is happening but for this example it fits.
The thing you should be more worried about, is that code going to have a lot of logic around it? Am i going to split that string into even more strings or even place it in different places? Is this the View of a MVC application?
For 1 and 2 it could be a toss up between either method. But for 3 i would go with method 2 for these reasons.
A view in a MVC web application is mostly html/css. So i want to see that be formatted correctly and i want to see in my editor the html coloring. So that is a plus.