Re: How New Is <<<HERE?
| From: | Jeremy Johnstone | Date: | Thu, 25 Dec 2003 19:13:10 +0000 |
| Subject: | Re: How New Is <<<HERE? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173323@lists.php.net to get a copy of this message | ||
AFAIK, it has been in PHP since the beginning of PHP4. I could be wrong,
but I think it was one of the new features added when 4.0 came out. Here
is a little reference material for you on it.
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Without seeing a code snippet, I can't tell you what your doing wrong.
Probably something simple, but hopefully the document above will help
you. Another resource which gives a decent guide to HEREDOC's is the
fairly new book "Core PHP Programming Third Edition". It's been a while
since I read it, but if memory serves it has atleast a page or two on
it's usage. I also highly recommend that book anyway to any PHP
programmer, beginner all the way to highly advanced. I thought I knew
almost everything about PHP and even I still learned about a new
function or two from the book. Very worthwhile.
Jeremy
On Thu, 2003-12-25 at 12:44, stiano@optonline.net wrote:
> I'm running PHP version 4.3.0 on a Macintosh PowerBook with OS 10.2.1,
> doing some PHP tutorial exercises. And I've run across something I haven't
> seen before in the sample code I'm seeing:
>
> print <<<HERE
> [multiple lines of code]
> HERE;
>
> Now, from what I've read, it seems that the point of "<<<HERE ...
> HERE;" is
> to execute all the code between the two "HEREs".
>
> But when I run this thru my browsers--Netscape 7.02 and IE 5.2--I get the
> following error message:
>
> Parse error: parse error, unexpected $ in [path to file] [line number]
>
> Is this "<<<HERE ... HERE;" new to PHP sometime after version 4.3.0, and
> I'm just out of luck unless I upgrade?
>
> Thank you.
>
> Steve Tiano
>
>
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .