rfc:heredoc-with-double-quotes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rfc:heredoc-with-double-quotes [2008/03/28 13:21]
lstrojny Adding link to the thread
rfc:heredoc-with-double-quotes [2017/09/22 13:28]
Line 1: Line 1:
-===== Request for Comments: Allow HEREDOC syntax with double quotes ===== 
  
-  * **Version:** 0.1 
-  * **Date:** 2008-03-22 
-  * **Author:** Lars Strojny 
-  * **Status:** [[http://marc.info/?l=php-internals&m=120621710002231&w=2|Under Discussion]] 
- 
-==== 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> 
- 
-==== Code examples ==== 
-=== Classic HEREDOC === 
-<code php> 
-$var = "Hello world"; 
- 
-$str = <<<LABEL 
-$var 
-LABEL; 
-</code> 
-"$var" is evaluated 
- 
-=== NOWDOC === 
-<code php> 
-$str = <<<'LABEL' 
-$var 
-LABEL; 
-</code> 
-"$var" is taken literally 
- 
-=== Proposed HEREDOC === 
-<code php> 
-$var = 'Hello world'; 
- 
-$str = <<<"LABEL" 
-$var 
-LABEL; 
-</code> 
- 
-"$var" would be intepreted. 
rfc/heredoc-with-double-quotes.txt · Last modified: 2017/09/22 13:28 (external edit)