If I am inside a ton of PHP code, instead of coming out of PHP I usually write code which contains variables like so:
echo "This is how I use a ".$variable." inside a string";
but is it more efficient to actually get out of PHP like so:
?>
Should I instead use the <? echo $variable; ?> like this
<? // then back into PHP
Throughout a page there will be lots of instances of code like this as I fill pages with dynamic content, or is this too much of a generalisation?
I only suggest breaking out of php tags when echoing HTML, not just a string.
This is fine for just a string:
But with HTML, personally, I like to do this: