|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #8685 heredoc: remove column 1 closing identifier requirement
Submitted: 2001-01-12 16:22 UTC Modified: 2015-01-08 22:16 UTC
Avg. Score:4.7 ± 0.5
Reproduced:15 of 15 (100.0%)
Same Version:9 (60.0%)
Same OS:8 (53.3%)
From: h dot radi at nme dot at Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: h dot radi at nme dot at
New email:
PHP Version: OS:


 [2001-01-12 16:22 UTC] h dot radi at nme dot at
why must the closing tag be in column 1 ?
i think it schould be enought that it stays in its own line.

      echo <<<EOF
         ... lots of text ...

looks very ugly and messes up all code beautifiers and autoindention.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-28 20:38 UTC]
Many script languages that support here doc syntax require closing tag at col 1. 

Won't change.
 [2002-01-29 20:17 UTC]
There are good reasons this will not be implemented.
(As original(?) author memtioned)

Think about possibility that begin/end of heredoc mark appears in text and 
how paser handle text and begin/end of heredoc.

Supporting this does not worth effort, IMHO.
This is just my opinion, so feel free to create/submit patch. ;)
 [2002-03-25 21:26 UTC] marcj at historia dot et dot tudelft dot nl
I agree with h.radi, philip and phanto: the end tag should not have to start at the beginning of a line. As a counterexample, consider bash.

In fact, I'd like to ask for something similar to bash's `<<-' (i.e., a here doc with leading tabs removed, both from the text _and_ the end tag. See man bash). This way, one can have both the source and the html looking clean and indented.
 [2002-07-09 17:49 UTC] phpbug at takemeout dot ski-info-online dot com
This has bugged me as well. I used here-docs a lot in Unix scripting and, of course, continue to in PHP. I actually take pride and spend time beautifying my code (ahhh) and it is a bit annoying to a line completely out of place. I support the change.
 [2002-07-10 02:11 UTC]
I had a look at implementing this yesterday, but it was harder than it seemed in the first place.
It can also be that my lexx knowlegde is a bit rusty :)

 [2003-01-26 15:48 UTC] brannonsmith at yahoo dot com
I like the example by with bash. This is an important issue for readability, which should be important to any developer (IMHO). Since it is implemented in open-source bash, could the bash parser handling of it offer any hints or solutions as to how to integrate it into PHP? Or are they so dissimilar that it would be useless? I am not a bash internals hacker (nor PHP) so maybe I'm barking up the wrong tree. In any case, indentable closing tags would be an OUTSTANDING feature tho. Hope it hasn't been forgotten in 2003...
 [2010-12-31 20:13 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem -Operating System: +Operating System: * -PHP Version: 4.3.0 +PHP Version: *
 [2015-01-08 22:16 UTC]
-Status: Open +Status: Wont fix
 [2015-01-08 22:16 UTC]
There's been no interest in changing this, and it's largely unnecessary anyway: single- and double-quoted strings can be multiline. So I'll mark this as wontfix.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 00:05:45 2022 UTC