mirror of
https://github.com/php/php-src.git
synced 2024-12-25 17:59:52 +08:00
4887357269
RFC: https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes * The ending label no longer has to be followed by a semicolon or newline. Any non-label character is fine. * The ending label may be indented. The indentation will be stripped from all lines in the heredoc/nowdoc string. Lexing of heredoc strings performs a scan-ahead to determine the indentation of the ending label, so that the correct amount of indentation can be removed when calculting the semantic values for use by the parser. This makes the implementation quite a bit more complicated than we would like :/
28 lines
384 B
PHP
28 lines
384 B
PHP
--TEST--
|
|
Flexible heredoc syntax complex test 3: interpolated nested heredocs
|
|
with the same delimiter name with different levels of indentation
|
|
--FILE--
|
|
<?php
|
|
|
|
${' a'} = ' b';
|
|
${' b'} = 'c';
|
|
${"b\n b"} = 'b';
|
|
|
|
var_dump(<<<DOC1
|
|
a
|
|
${<<<DOC2
|
|
b
|
|
${<<<DOC3
|
|
a
|
|
DOC3}
|
|
DOC2
|
|
}
|
|
c
|
|
DOC1);
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(8) " a
|
|
b
|
|
c"
|