[DOC-CVS] [doc-en] master: Clarify closing identifier indentation behaviour of Heredoc (#5763)
[email protected] (AlwaysVictorious via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: AlwaysVictorious (AlwaysVictorious)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-08-17T12:02:17+01:00
Commit: https://github.com/php/doc-en/commit/0d964bcaac6618dd80b974eb6fcdf3c67ca07340
Raw diff: https://github.com/php/doc-en/commit/0d964bcaac6618dd80b974eb6fcdf3c67ca07340.diff
Clarify closing identifier indentation behaviour of Heredoc (#5763)
Changed paths:
M language/types/string.xml
Diff:
diff --git a/language/types/string.xml b/language/types/string.xml
index 2013b079d4c5..8aae48aefd5e 100644
--- a/language/types/string.xml
+++ b/language/types/string.xml
@@ -216,8 +216,9 @@ echo 'Variables do not $expand $either', PHP_EOL;
</simpara>
<simpara>
- The closing identifier may be indented by space or tab, in which case
- the indentation will be stripped from all lines in the doc string.
+ The closing identifier may be indented with spaces or tabs. Whitespace
+ equal to the closing identifier's indentation is then removed from the
+ beginning of every line in the heredoc string.
Prior to PHP 7.3.0, the closing identifier <emphasis>must</emphasis>
begin in the first column of the line.
</simpara>
@@ -233,7 +234,7 @@ echo 'Variables do not $expand $either', PHP_EOL;
<programlisting role="php">
<![CDATA[
<?php
-// no indentation
+// closing identifier not indented
echo <<<END
a
b
@@ -241,12 +242,12 @@ echo <<<END
\n
END;
-// 4 spaces of indentation
+// closing identifier indented with 3 spaces; 3 spaces stripped from each line
echo <<<END
a
b
c
- END;
+ END;
]]>
</programlisting>
&example.outputs.73;
@@ -256,9 +257,9 @@ echo <<<END
b
c
- a
- b
-c
+ a
+ b
+ c
]]>
</screen>
</example>