# RFC: HEREDOC with double quotes

- Status: Implemented (PHP 5.3)
- Original: https://wiki.php.net/rfc/heredoc-with-double-quotes
- Page: https://externals.io/rfc/heredoc-with-double-quotes
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Discussions on the mailing list

No thread found.

---

## Request for Comments: Allow HEREDOC syntax with double quotes

- **Version:** 0.1.1
- **Date:** 2008-03-22
- **Author:** Lars Strojny
- **Status:** [Implemented in PHP 5.3](http://news.php.net/php.zend-engine.cvs/6597)
- **Votes:** (+6/-4) 
    - **Pro:** [Pierre A. Joye](http://marc.info/?l=php-internals&m=120679140717702&w=2), [Felipe Pena](http://marc.info/?l=php-internals&m=120674698503890&w=2) , [Marcus Boerger](http://marc.info/?l=php-internals&m=120636366616273&w=2), [Gwynne Raskind](http://marc.info/?l=php-internals&m=120671376003536&w=2), Christopher Jones, Lars Strojny
    - **Contra:** [Steph Fox](http://marc.info/?l=php-internals&m=120623748226109&w=2), [Edward Z. Yang](http://marc.info/?l=php-internals&m=120623999628496&w=2), [Hannes Magnusson](http://marc.info/?l=php-internals&m=120627311627368&w=2), [Stanislav Malyshev](http://marc.info/?l=php-internals&m=120623665525308&w=2)

### 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:

```php
$var = '$var'; // Literally
$var = "$var"; // Intepreted
```

### Code examples

#### Classic HEREDOC

```php
$var = 'Hello world';
 
$str = <<<LABEL
$var
LABEL;
 
echo $str; // gives: Hello world
```

“$var” is interpreted.

#### NOWDOC

```php
$var = 'Hello world';
 
$str = <<<'LABEL'
$var
LABEL;
 
echo $str; // gives: $var
```

“$var” is taken literally.

#### Proposed HEREDOC

```php
$var = 'Hello world';
 
$str = <<<"LABEL"
$var
LABEL;
 
echo $str; // gives: Hello world
```

“$var” would be interpreted.
