rfc:heredoc-with-double-quotes
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | rfc:heredoc-with-double-quotes [2011/04/06 10:59] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Request for Comments: Allow HEREDOC syntax with double quotes ===== | ||
+ | * **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 = " | ||
+ | </ | ||
+ | |||
+ | ==== Code examples ==== | ||
+ | === Classic HEREDOC === | ||
+ | <code php> | ||
+ | $var = 'Hello world'; | ||
+ | |||
+ | $str = <<< | ||
+ | $var | ||
+ | LABEL; | ||
+ | |||
+ | echo $str; // gives: Hello world | ||
+ | </ | ||
+ | " | ||
+ | |||
+ | === NOWDOC === | ||
+ | <code php> | ||
+ | $var = 'Hello world'; | ||
+ | |||
+ | $str = <<<' | ||
+ | $var | ||
+ | LABEL; | ||
+ | |||
+ | echo $str; // gives: $var | ||
+ | </ | ||
+ | " | ||
+ | |||
+ | === Proposed HEREDOC === | ||
+ | <code php> | ||
+ | $var = 'Hello world'; | ||
+ | |||
+ | $str = <<<" | ||
+ | $var | ||
+ | LABEL; | ||
+ | |||
+ | echo $str; // gives: Hello world | ||
+ | </ | ||
+ | |||
+ | " |
rfc/heredoc-with-double-quotes.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1