Doc #64943 [Opn]: Heredoc syntax specification
| From: | sixd@php.net | Date: | Wed, 29 May 2013 17:20:39 +0000 |
| Subject: | Doc #64943 [Opn]: Heredoc syntax specification | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9891@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64943&edit=1
ID: 64943
Updated by: sixd@php.net
Reported by: jduartedj at gmail dot com
Summary: Heredoc syntax specification
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Both issues are already covered in the doc.
I agree the first one could be made more obvious: currently that page says "After this
operator, an identifier is provided, then a newline." This could be
improved.
The warning box is already very clear about your second point:
"It is very important to note that the line with the closing identifier must
contain no other characters, except possibly a semicolon (;)." This could also
be improved because the semicolon is mandatory.
Previous Comments:
------------------------------------------------------------------------
[2013-05-29 15:08:23] jduartedj at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/language.types.string
---
It is not mentioned that heredoc syntax requires:
* NO SPACE after each identifier
* NO CHARACTERS before the END identifier
Test script:
---------------
//PROPER
echo <<<EOS
my freestyle text
EOS;
//IMPROPER (space after "<<<EOS")
echo <<<EOS
my freestyle text
EOS;
//IMPROPER (space after "EOS;")
echo <<<EOS
my freestyle text
EOS;
//IMPROPER (spaces before "EOS;")
echo <<<EOS
my freestyle text
EOS;
Expected result:
----------------
Fail all except first
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64943&edit=1