#40283 [NEW]: Heredoc syntax documentation incorrect?
| From: | hugorumens at yahoo dot com | Date: | Tue, 30 Jan 2007 09:25:17 +0000 |
| Subject: | #40283 [NEW]: Heredoc syntax documentation incorrect? | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969375098@lists.php.net to get a copy of this message | ||
From: hugorumens at yahoo dot com
Operating system: WinXP
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Heredoc syntax documentation incorrect?
Description:
------------
Regarding this page:
http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
The first sentence reads:
"Another way to delimit strings is by using heredoc syntax ("<<<"). One
should provide an identifier after <<<, then the string, and then the same
identifier to close the quotation."
Surely this should read, for example:
"...One should provide an identifier after <<<, followed by a newline
character, then the string..."
The same situation as described for the closing identifier is needed for
the opening, that of a newline char, else a
parse error occurs. This is not clear in the docs as is.
Secondly:
Are the references to "except possibly a semicolon (;)" correct? A
semicolon is absolutely needed after the closing identifier to avoid a
parse error.
Thanks.
Reproduce code:
---------------
<?php
$somevar = <<<ABC
This is my string that HAS to start on this newline.
If the word 'This' was on the same line as the ABC
identifier, I'd get a parse error.
The semicolon after my closing identifier is absolutely
needed.
ABC;
?>
--
Edit bug report at http://bugs.php.net/?id=40283&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40283&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40283&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40283&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40283&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40283&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40283&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40283&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40283&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40283&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40283&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40283&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40283&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40283&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40283&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40283&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40283&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40283&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40283&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40283&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40283&r=mysqlcfg