rfc:heredoc-with-double-quotes

This is an old revision of the document!


Abstract

In 5_3 we introduced NOWDOC in and it would be logical to allow a double quoted syntax sister of NOWDOC which acts as HEREDOC (same as for $var = “$var” vs $var = '$var'). Currently we have the following options:

Code examples

Classic HEREDOC

$var = "Hello world";
 
$str = <<<LABEL
$var
LABEL;

“$var” is evaluated

NOWDOC

$str = <<<'LABEL'
$var
LABEL;

“$var” is taken literally

Proposed HEREDOC

$var = 'Hello world';
 
$str = <<<"LABEL"
$var
LABEL;

“$var” would be intepreted.

rfc/heredoc-with-double-quotes.1206709956.txt.gz · Last modified: 2017/09/22 13:28 (external edit)