|
Posted by Sandman on 11/06/05 13:55
In article <mrPaf.768$xD6.46316@news.xtra.co.nz>,
"windandwaves" <winandwaves@coldmail.com> wrote:
> Hi Folk
>
> My question is:
> echo all the time vs echo at the end - what is faster
>
> Let me explain
>
> I used to write pages like this:
>
> echo "<head> ";
> {code code code}
> echo "<body>";
> {code code code, talk to the database, etc...}
> echo "<div>some more shite</div>";
> {code code code}
> echo "</html>";
>
>
> Now I do this:
>
> $v .= "<head> ";
> {code code code}
> $v .= "<body>";
> {code code code, talk to the database, etc...}
> $v .= "<div>some more shite</div>";
> {code code code}
> $v .= "</html>";
> echo $v;
>
> The advantage of the second method is that I can still manipulate the
> content before it goes out. for example, I can replace double spaces and
> tabs, alter menus, etc... using simple replace functions.
>
> Now, my question is, what is faster or better? I kind of like the latter
> option, but I do not want to use it if it makes my website (significantly)
> slower.
<?
ob_start();
?>
HTML Code and stuff
<?
$output = ob_get_clean();
print $output;
?>
I.e. no need to rewrite all your stuff.
--
Sandman[.net]
Navigation:
[Reply to this message]
|