So, in Perl and PHP, you can produce a block of text using a number of the “<” symbols:
Perl:
return <<TEXT;
<a href=$foo>Perl interpolates this properly</a>
TEXT
PHP:
return <<<TEXT
<a href=$bar>PHP does not interpolate this...</a>
TEXT;
So, my question is, is there a way to (cleanly) do this in PHP like in Perl?
I have tried <?...?> and <?php...?>, but they do the same thing…
Also, this is really a subset of the entire block of text… otherwise I would just build the string.
Yes, it’s called heredoc syntax:
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc