note 59248 added to language.types.string
| From: | webmaster at rephunter dot net | Date: | Wed, 30 Nov 2005 16:57:07 +0000 |
| Subject: | note 59248 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99369@lists.php.net to get a copy of this message | ||
Use caution when you need white space at the end of a heredoc. Not only is the mandatory final
newline before the terminating symbol stripped, but an immediately preceding newline or space
character is also stripped.
For example, in the following, the final space character (indicated by \s -- that is, the
"\s" is not literally in the text, but is only used to indicate the space character) is
stripped:
$string = <<<EOT
this is a string with a terminating space\s
EOT;
In the following, there will only be a single newline at the end of the string, even though two are
shown in the text:
$string = <<<EOT
this is a string that must be
followed by a single newline
EOT;
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59248
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59248&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59248&report=yes
Search -- http://master.php.net/manage/user-notes.php