Forum Moderators: coopster
I don't think there is much of a difference really. Again andreas benchmarked it and we found very little difference.
One thing with echo was that you should use commas between values and it saves time.
echo "<p>" . $somevar . "<br> ";
should be
echo "<p>",$somevar,"<br> ";
then php doesn't have to construct the string before it echo, it can just spit out the bits as it goes.
$somearr[$counter][0] won't be resolved between double quotes so you need to do it the other way.
echo "<a href=\"www.domain.com\">",$somearr[$counter][0],"</a>";
with a normal var you can just use the first example you had.
echo <<< END_TEXT
Put any code in here you want<br>
Including <b>HTML</b>, "quotes", and $variables
and not having to
'worry'
about
\b\a\c\k\s\l\a\s\h\e\s.
END_TEXT; Very nice for big blocks of html smattered with variables.
Most of my preproduction stuff ends up with?><? running around to kick the syntax highlighting back on. I forget to remove them every once in a while, raises some questions. ;)
It is always hilarious how many ways we have to do some very simple things. Makes you wonder sometimes if best practice exists or it is just best practice for you.