Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] "here" document From: Jordan Pickup (jordan <email protected>)
Date: 07/14/00

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 <email protected>>
To: <php-general <email protected>>
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 <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>