note 107138 added to language.types.string
| From: | gtisza at gmail dot com | Date: | Tue, 10 Jan 2012 14:32:10 +0000 |
| Subject: | note 107138 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185518@lists.php.net to get a copy of this message | ||
The documentation does not mention, but a closing semicolon at the end of the heredoc is actually
interpreted as a real semicolon, and as such, sometimes leads to syntax errors.
This works:
<?php
$foo = <<<END
abcd
END;
?>
This does not:
<?php
foo(<<<END
abcd
END;
);
// syntax error, unexpected ';'
?>
Without semicolon, it works fine:
<?php
foo(<<<END
abcd
END
);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.82.94.138
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- https://master.php.net/note/edit/107138
Del: integrated -- https://master.php.net/note/delete/107138/integrated
Del: useless -- https://master.php.net/note/delete/107138/useless
Del: bad code -- https://master.php.net/note/delete/107138/bad+code
Del: spam -- https://master.php.net/note/delete/107138/spam
Del: non-english -- https://master.php.net/note/delete/107138/non-english
Del: in docs -- https://master.php.net/note/delete/107138/in+docs
Del: other reasons-- https://master.php.net/note/delete/107138
Reject -- https://master.php.net/note/reject/107138
Search -- https://master.php.net/manage/user-notes.php