|
Posted by Chung Leong on 11/09/06 18:35
M wrote:
> Hi,
> Suppose you have the situation where you have say 20 blocks of text (~250
> chars each) in a MySQL db that you need to display, but each has a condition
> to check to see whether you should display it or not.
>
> As far as I can see, you have 2 options:
>
> 1. A continuous block of php, with all the text displayed via echo commands
>
> 2. Or jumping in and out of php for each block of text i.e.
> <?php ...if condition ?>
> pure html
> <?php ...if end ?>
>
> Which would be more performant? I understand that echo's are poor in
> performance with large blocks of text, but what is the overhead of the web
> server (Apache) making repeated calls to the php engine?
>
> My general point is, is it "better" to echo html out (css, formatting and
> all) or continuously jump in/out of php (and only echo MySQL data) if you
> have a lot of php logic / control in your page?
>
> Thanks,
> M
Text outside of <?php ?> is compiled to echo operations. So there's no
basic difference between the two methods.
Navigation:
[Reply to this message]
|