rfc:heredoc-with-double-quotes
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:heredoc-with-double-quotes [2008/03/28 13:12] – created lstrojny | rfc:heredoc-with-double-quotes [2008/06/25 16:45] – sixd | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Abstract | + | ===== Request for Comments: Allow HEREDOC syntax with double quotes ===== |
- | 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 | + | |
+ | * **Version: | ||
+ | * **Date:** 2008-03-22 | ||
+ | * **Author:** Lars Strojny | ||
+ | * **Status:** [[http:// | ||
+ | * **Votes:** (+6/-4) | ||
+ | * **Pro:** [[http:// | ||
+ | * **Contra:** [[http:// | ||
+ | |||
+ | ==== Purpose | ||
+ | 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. The reason to do this is mainly consistency with with variable declarations: | ||
+ | <code php> | ||
+ | $var = '$var'; // Literally | ||
+ | $var = "$var"; // Intepreted | ||
+ | </ | ||
==== Code examples ==== | ==== Code examples ==== | ||
=== Classic HEREDOC === | === Classic HEREDOC === | ||
<code php> | <code php> | ||
- | $var = "Hello world"; | + | $var = 'Hello world'; |
$str = <<< | $str = <<< | ||
$var | $var | ||
LABEL; | LABEL; | ||
+ | |||
+ | echo $str; // gives: Hello world | ||
</ | </ | ||
- | " | + | " |
=== NOWDOC === | === NOWDOC === | ||
<code php> | <code php> | ||
+ | $var = 'Hello world'; | ||
+ | |||
$str = <<<' | $str = <<<' | ||
$var | $var | ||
LABEL; | LABEL; | ||
+ | |||
+ | echo $str; // gives: $var | ||
</ | </ | ||
- | " | + | " |
=== Proposed HEREDOC === | === Proposed HEREDOC === | ||
Line 28: | Line 48: | ||
$var | $var | ||
LABEL; | LABEL; | ||
+ | |||
+ | echo $str; // gives: Hello world | ||
</ | </ | ||
- | " | + | " |
rfc/heredoc-with-double-quotes.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1