RE: [PHP] "here" document

From: Date: Fri, 14 Jul 2000 19:52:29 +0000
Subject: RE: [PHP] "here" document
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6696@lists.php.net to get a copy of this message
what i'd like to see with the here doc deal, you can do this... $myvar<<<OPTION This is a bunch of formated text that can occour often in a program. using this, instead of $out="blah\t\tblah blah\nblah\tblah\n\n"; would be soo much easier OPTION; echo $myvar; > -----Original Message----- > From: Jordan Pickup [mailto:jordan@cynetech.com] > Sent: Friday, July 14, 2000 11:46 AM > To: teo@digiro.net; PHP General > Subject: Re: [PHP] "here" document > > > You don't even need that. The functionality for that is kinda built in. > > Below is the contents of test.php: > ************************************* > <HTML><HEAD></HEAD> > <BODY <?php print($bodybgcolor); ?>> > <?php > print ("This output is from php!<BR>"); > print ("So is this...<BR>"); > ?> > This output is from HTML!<BR> > And can be as many lines as I want.<BR> > <?php print("<HR>Back to PHP!<BR>"); > print("I can go back and forth as many times as I want."); > print("I can even stick plain HTML inside functions, if/switch statements, > and loops."); > for ($i = 0; $i < 3; $i++) > { > ?> > This is HTML inside a FOR loop (Round <?php print($i); ?>) <BR> > <?php > } > print("It's really kinda cool!"); > ?> > </BODY> > </HTML> > ******************************************* > The difference is that the "here document" function in Perl is > used to embed > HTML in the Perl file. PHP is the other way around. It's not HTML embedded > in a Php file, it's Php embedded in an HTML file. Personally, I like it > better this way. With this ability, I can't see any need for perls "here > document" function. This was is easier. > > jordan > > > ----- Original Message ----- > From: "Teodor Cimpoesu" <teo@digiro.net> > To: <php-general@lists.php.net> > Sent: Friday, July 14, 2000 10:12 AM > Subject: Re: [PHP] "here" document > > > > Hi Zack! > > On Fri, 14 Jul 2000, Zack Beatty wrote: > > > > > Is there a Perl-style "here document" function in PHP for printing a > block > > > of output, such as: > > > <? > > > print <<END_OF_HERE > > > blah > > > blah > > > blah > > > yada > > > yada > > > yada > > > END_OF_HERE > > > ?> > > > > > > BTW, I did search the manual and list archives already. So please no > RTFM > > > comments. Thanks. > > hmm, I though I sow it documented in "features" ... > > $foo = <<<HTML > > some stuff $here > > HTML; > > and > > print <<<ENDTAG > > some stuff $here[too] > > ENDTAG; > > > > -- teodor > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#6696) next »