Re: How New Is <<<HERE?
| From: | Jasper Bryant-Greene | Date: | Thu, 25 Dec 2003 21:43:21 +0000 |
| Subject: | Re: How New Is <<<HERE? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173326@lists.php.net to get a copy of this message | ||
It doesn't execute the code between the <<<HERE ... HERE. It's called heredoc syntax for delimiting strings.
Say you had a really long string, with lots of variables in it that needed parsing, and lots of " and ' signs. Instead of using print "" you can use the heredoc syntax. You start with <<< and an identifier (in this case 'HERE') and then end with that identifier and a semicolon. It's just a way for delimiting strings, so you need to look for what's causing that unexpected $ just as if you were looking at a "" string. I can't help you any more without a code snippet.
-- Jasper
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/ .