Re: Set Variable to Multiple Lines

From: Date: Thu, 29 Aug 2002 18:04:02 +0000
Subject: Re: Set Variable to Multiple Lines
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114533@lists.php.net to get a copy of this message
What you're looking for seems to be called the 'here document' syntax. I've always seen it used with print and there's a reference to it in the print function (okay, construct) PHP documentation, but a quick test shows that you can also use it to assign to variables. As follows: $var = <<<END Several lines of text would go here. END; Perl only uses two brackets (IIRC) for the same functionality. ..michael.. On Thu, 2002-08-29 at 10:42, Mike richardson wrote: > > I've been searching for this old php feature (perhaps it was > deprecated), and can't get the right keywords to look it up. > > There was a way, similar to the perl method shown below, to set multiple > lines of data equal to a variable. > > (in perl) > $variable = __SOME_HEADER_HERE__ > > Put whatever is desired here, including $variables. > > Just end it with this: > > __SOME_HEADER_HERE__; > > > Anyone know what this is for PHP? > > Best wishes > > Michael Richardson > Web Developer > (520) 529-2000 > merichardson@mdausa.org > > ======================== > // http://www.mdausa.org // > ======================== > > ..very few phenomena can pull someone out > of Deep Hack Mode, with two noted exceptions: > being struck by lightning, or worse, your *computer* > being struck by lightning. > -- Matt Welsh >

« previous php.general (#114533) next »