php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #5007 enable no-resolve mode for here docs
Submitted: 2000-06-13 19:22 UTC Modified: 2008-10-07 11:46 UTC
From: waldschrott at kiffen dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 Latest CVS (13/06/2000) OS: all
Private report: No CVE-ID: None
 [2000-06-13 19:22 UTC] waldschrott at kiffen dot de
Perl has <<"MARK" and <<'MARK' (as Stas told me),
it would be handy for PHP too...
I think sample code isn?t need, because it?s an existing feature in Perl core devolpers know of.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-08 10:49 UTC] waldschrott at kiffen dot de
--<cut>--
The format of here-documents is as follows:

	  <<[-]word
			here-document
	  delimiter

No parameter expansion, command  substitution,  arithmetic
expansion, or pathname expansion is performed on word.  If
any characters in word are quoted, the  delimiter  is  the
result  of  quote  removal  on  word, and the lines in the
here-document are not expanded.  If word is unquoted,  all
lines  of  the  here-document  are  subjected to parameter
expansion, command substitution, and arithmetic expansion.
In  the  latter case, the character sequence \<newline> is
ignored, and \ must be used to quote the characters \,  $,
and `.

If  the  redirection operator is <<-, then all leading tab
characters are stripped from  input  lines  and  the  line
containing  delimiter.   This allows here-documents within
shell scripts to be indented in a natural fashion.
--<cut>--  

 [2000-08-28 01:49 UTC] waldschrott@php.net
in addition we could make here-docs structured code friendly by adding sth. like a parameter (don?t know where,maybe <<<3"MARK")
indicationg how many tabs are prepended, thus the above would render
echo <<<3"MARK"
\t\t\tHello
\t\t\tMr. Foobar
\t\t\t\tTest
MARK;
as

Hello
Mr. Foobar
\tTest

and not with these redundant 3*\t?s in front of every line

then users can user here-docs in classes and functions *without* crippling their code to ugliness  
 [2008-10-07 10:27 UTC] mark at hell dot ne dot jp
I believe this feature request can now be closed (with PHP 5.3.0).

http://fr.php.net/language.types.string#language.types.string.syntax.nowdoc
 [2008-10-07 11:46 UTC] johannes@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Yes, 5.3 implements such a feature.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 16:01:35 2024 UTC