Page 1 of 1

Easy bit I cant recall how it's done ...

Posted: Tue Jul 12, 2005 7:08 am
by Stryks
... in fact, I couldnt think of a better subject line. :D

Just trying to remember how I can stream to a string.

I seem to recall it looking something like ...

Code: Select all

$value = <<STUFF

blah
blah
blah

STUFF>>
Anyone have any idea what I'm talking about?

Cheers

Posted: Tue Jul 12, 2005 7:28 am
by Chris Corbyn
It's called HEREDOC ;)

Code: Select all

$somevar = <<<ANYWORD
Content goes here with variables escaped in
{$curly_brackets} like so but usually you don't need the
curly brackets.

The whole string gets parsed like a double quoted string across
multiple lines without the need to escape quotes.
ANYWORD;


//Or

echo <<<SOMETHING
Put the content here
however you want!
SOMETHING;

//

Posted: Tue Jul 12, 2005 7:44 pm
by harrisonad
Next time, try to make your subject line relevant to you problem. :wink: