Why does heredoc fail in this instance?
| From: | Peter J. Schoenster | Date: | Mon, 04 Feb 2002 18:32:06 +0000 |
| Subject: | Why does heredoc fail in this instance? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83430@lists.php.net to get a copy of this message | ||
Hi
If I use $snippet = ""; and escape the quotes in the block then it
works. But if I use it as is below, it fails with no useful error
message. Why?
Thanks,
Peter
function GetAddCommentSnippet($args) {
$topic_id = $args[id];
$return_page = $args[return_page];
$snippet = <<<EOS
<form action="$this->this_cgi" method="post">
<br>Your First Name: <input type="text" name="FirstName"
value="">
<br>Your Last Name: <input type="text" name="LastName"
value="">
<br>Your Email Address: <input type="text" name="EmailAddress"
value="">
<br>Your Comments:
<br>
<textarea cols="40" rows="4" name="Comments"></textarea>
<br>
<input type="submit" value="submit now">
<input type="hidden" name="action" value="AddComment">
<input type="hidden" name="response_to_id" value="$topic_id">
<input type="hidden" name="r" value="$return_page">
</form>
EOS;
return $snippet;
} // END GetAddCommentSnippet
---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
-- Philip K. Dick