This is a discussion on <<< text within the alt.comp.lang.php forums, part of the PHP Programming Forums category; What does the "<<<END" do? (from :http://justinvincent.com/home/articl...cleId=8&page=...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
What does the "<<<END" do? (from :http://justinvincent.com/home/articl...cleId=8&page=2) <?php $turkeys = “variables”; print <<<END It is nice to know that “you” can print any amount of text on <font color=”red”>multiple</font> lines with <b>any</b> character and still include $turkeys. END; ?> -W |
|
|||
|
http://nl2.php.net/echo
RTFM On Sat, 13 Dec 2003 14:54:12 -0500, Double U <PleaseSpamMe@myEmail.com> wrote: > >What does the "<<<END" do? (from :http://justinvincent.com/home/articl...cleId=8&page=2) > ><?php >$turkeys = “variables”; > >print <<<END >It is nice to know that “you” can print any amount of text on ><font color=”red”>multiple</font> lines with <b>any</b> >character and still include $turkeys. > END; > > >?> > >-W |
|
|||
|
Double U wrote:
> What does the "<<<END" do? (from :http://justinvincent.com/home/articl...cleId=8&page=2) The "<<<" tells us that heredoc syntax is used. http://www.php.net/manual/en/language.types.string.php By the way, I'd take whatever you read from that article with a pinch of salt; on second thoughts, better make that a teaspoonful. I only read the document you linked to, because I found it awfully yawn- inducing, but I lost count of the mistakes and statements which may lead well-intentioned folks astray. For example, in heredoc syntax, the closing identifier ("END" in this case) must be directly preceded by a newline. No other characters, except an affixable semicolon, are allowed on that line. Unfortunately the markup used in the article, more often than not, causes indentation in a visual presentation, giving a misleading suggestion that whitespace is permitted before the closing identifier. That's simply not the case. And, sorry, I can't resist mentioning the clueless use of "smart quotes" in place of proper QUOTATION MARKs. They're meaningless in both your posting and the article itself. It's not entirely obvious who wrote the article and the last thing I want to do right now is trawl through a site like that. Bah, humbug. ;-) -- Jock |
|
|||
|
Some time around Sat, 13 Dec 2003 21:07:54 -0000 (give or take a month), someone called John Dunlop
<john+usenet@johndunlop.info> rambled on about: > >By the way, I'd take whatever you read from that article with a pinch >of salt; on second thoughts, better make that a teaspoonful. I only >read the document you linked to, because I found it awfully yawn- >inducing, but I lost count of the mistakes and statements which may >lead well-intentioned folks astray. When I was reading that on the site and then looking at the php.net manual it didn't make sense to me and I could not get it to work. Which only frustrated me. I guess what confused me is I expected it to have "END>>>" to close it. I confused the EOD statement at php.net to be similar to the EOL (End of Line) I learned programming by using Pascal, COBOL (and even more obsolete languages) and PHP just has not clicked for me yet. Usually if I see an example and read the manual I get it. Of course maybe I shouldn't try and understand this after working a 10-12 hour day where I am very unhappy. Thank you for your help and the little bit you said made me understand something else. > Bah, humbug. ;-) Well Happy Holidays anyway. If you care it was written by Justin Vincent who wrote the ezSQL functions. -W |