Re: echo " HTML code ";
| From: | Daniel Grace | Date: | Thu, 31 Jan 2002 14:50:05 +0000 |
| Subject: | Re: echo " HTML code "; | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82934@lists.php.net to get a copy of this message | ||
<André> wrote in message
news:5.1.0.14.2.20020131110404.02d1c3d0@pop.vix.terra.com.br...
> I have a PHP file that I show values of variables in several parts, and
for
> that I put in almost the whole page
>
> echo"... HTML code + PHP codes (variables, functions, etc.) + HTML code...
> ";
>
>
> I don't know nor why I put, I think it went to not to be finishing and
> beginning PHP parts as:
>
> <?php echo"$variable"; PHP functions; etc.?> HTML code <?php
> echo"$variable"; PHP functions; etc.?> HTML code <?php
> echo"$variável";
PHP
> functions; etc.?> HTML code
>
> Can these several echo's harm the processing of the server? Can that turn
> slow the visualization of the page? Should I remove the maximum possible
of
> echo"... HTML Code ... "; or can I leave how it is?
>
> André
Not using echo IS faster, but the difference is barely noticeable. If you're
outputting lots of PHP variables, your current way is fine.
By the way, you may wish to consider using 'here documents':
echo <<<XYZZY
Here documents are nice. They work like doubly-quoted strings do,
only you don't need to escape any of the "quotes", single or double.
They can also do $variable expansion and all those are nice things
(escape your \$-signs if you use them for anything else),
and of course <html> will work just fine. For more about
Here Documents, take a look at here:
http://www.php.net/manual/en/language.types.string.php
XYZZY;
-- Daniel Grace