You can use the <<< sequence like this (this is called a Heredoc string):
$HtmlOutput = <<<_END
<form method="GET">
<div>Search Term: <input type="search" id="q" name="q"></div>
<div>Max Results: <input type="number" id="maxResults" name="maxResults" min="1" max="50" step="1" value="25"></div>
<input type="submit" value="Search">
</form>
_END;
$HtmlOutput = "";
$HtmlOutput .= <<<_END
_END;
The terminating marker must be at the start of a line and the only thing on the line (no comment or even whitespace after it!!!)
The advantage of this is that there is no need for line breaks, escape characters (\’ etc) – what is between the markers is output exactly as it appears but with any variable names evaluated. _END can be anything. You can also use &MyText <<< _END … to assign the contents to a variable instead of echoing.
You can include variables within the text. For complex variables you can enclose them in curley brackets like this:
blah blah {$foo->bar[1]} blah
Using with echo
You can do this:
echo <<<_END
_END;
or this:
$HtmlOutput = "";
$HtmlOutput .= <<<_END
_END;
echo($HtmlOutput);
Including a function call
${!${''} =(time())}
$HtmlOutput = <<<_END
<p>Somthing ${!${''} =(time())} someting</p>
_END;
(This is based on the topic here and relies on this nifty parser hack)