php.net |  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
Votes:15
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.

   if($foo)
   {
      echo <<<EOF
         ... lots of text ...
EOF;
   }

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

Won't change.
 [2002-01-29 20:17 UTC] yohgaki@php.net
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] derick@php.net
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 :)

Derick
 [2003-01-26 15:48 UTC] brannonsmith at yahoo dot com
I like the example by marcj@historia.et.tudelft.nl 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] jani@php.net
-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] ajf@php.net
-Status: Open +Status: Wont fix
 [2015-01-08 22:16 UTC] ajf@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC