Re: "here" document

From: Date: Fri, 14 Jul 2000 16:46:28 +0000
Subject: Re: "here" document
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-6666@lists.php.net to get a copy of this message
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 > >

« previous php.general (#6666) next »