[doc-en] master: Clarify closing identifier indentation behaviour of Heredoc (#5763)

From: Date: Mon, 17 Aug 2026 11:02:20 +0000
Subject: [doc-en] master: Clarify closing identifier indentation behaviour of Heredoc (#5763)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23567@lists.php.net to get a copy of this message
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>

« previous php.doc.cvs (#23567) next »