php-src/Zend/tests/flexible-heredoc-complex-test4.phpt
Thomas Punt 4887357269 Implement flexible heredoc/nowdoc syntax
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 :/
2018-04-13 21:35:37 +02:00

36 lines
434 B
PHP

--TEST--
Flexible heredoc syntax complex test 4: interpolated variable with
the same delimiter name as the heredoc
--FILE--
<?php
{
$FOO = "FOO";
define("FOO", "FOO");
$b = <<<FOO
Test
${
FOO
}
FOO;
var_dump($b);
}
{
$FOO = "FOO";
$b = <<<FOO
Test
${
FOO
}
FOO;
var_dump($b);
}
?>
--EXPECT--
string(8) "Test
FOO"
string(16) " Test
FOO"