note 115442 deleted from language.types.string by salathe
| From: | salathe@php.net | Date: | Mon, 04 Aug 2014 08:45:40 +0000 |
| Subject: | note 115442 deleted from language.types.string by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200098@lists.php.net to get a copy of this message | ||
Note Submitter: .
----
Here's an observation of HEREDOC:
<?php
function foo() {
return <<<EOT
Hello World
EOT
}
?>
This will give you a fatal error:
Parse error: syntax error, unexpected '}' in foo.php on line 6
To fix this, add a semicolon. I encountered this issue after removing the semicolon because my
editor wasn't highlighting correctly.
In my case, this works without messing up my editor's highlighting:
<?php
function foo() {
return <<<EOT
Hello World
EOT
;
}
?>
HTH