Results 1 to 2 of 2
Thread: "here document" syntax
Aug 12, 2003, 12:10 #1
"here document" syntax
I was reading up on a few things and i met this "here document" syntax. I was wondering how it works.
In the echo page of the PHP manual, there's :
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon no extra whitespace!
Also in the sitepoint article "Build An Automated PHP Gallery System In Minutes" by Mayank Gandhi, he used this style too, but not in echo.
[font=Courier New]$photo_category_list .= <<<__HTML_END
Thanks in advance!
Aug 12, 2003, 12:56 #2
- Join Date
- Jan 2003
- Calgary, Canada
- 0 Post(s)
- 0 Thread(s)
Well, I would recommend the manual, but you appear to already have read it...
It's just another way of defining strings, <<<[TEXT] is the start (just like " or ') and then you use [TEXT]; as the end tag.
It allows you to use " and ' without needing to escape them in text.Who walks the stairs without a care
It shoots so high in the sky.
Bounce up and down just like a clown.
Everyone knows its Slinky.