Doc #69231 [Opn->Nab]: Example 3 seems wrong
| From: | salathe@php.net | Date: | Thu, 12 Mar 2015 16:07:11 +0000 |
| Subject: | Doc #69231 [Opn->Nab]: Example 3 seems wrong | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11998@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69231&edit=1
ID: 69231
Updated by: salathe@php.net
Reported by: alejandroivan at ingenieros dot com
Summary: Example 3 seems wrong
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: Any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Yes, the example is correct.
The semicolon is a statement terminator, but in the cited example the statement is not finished yet
as we're in the middle of providing arguments in a function call.
When used in this way, the closing heredoc identifier must be on a line entirely of its own. E.g.
the following is not allowed:
<?php
vr_dump(array(<<<EOD
foobar!
EOD));
?>
Previous Comments:
------------------------------------------------------------------------
[2015-03-12 15:10:50] alejandroivan at ingenieros dot com
Description:
------------
---
From manual page: http://www.php.net/language.types.string
---
Is example 3 correct? The original example says:
<?php
var_dump(array(<<<EOD
foobar!
EOD
));
?>
According to heredoc explanation, the string should end with "EOD;":
<?php
var_dump(array(<<<EOD
foobar!
EOD;
));
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69231&edit=1