|
Posted by Tim Hunt on 11/09/06 15:58
M wrote:
> "ZeldorBlat" <zeldorblat@gmail.com> wrote in message
> news:1163082078.036743.251700@e3g2000cwe.googlegroups.com...
> >
> > David T. Ashley wrote:
> >> "M" <nospam@here.thankyou> wrote in message
> >> news:NjG4h.49647$r61.43856@text.news.blueyonder.co.uk...
> >> >
> >> > 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?
> >>
> >
> > It's also worth noting that Apache only makes one call to the PHP
> > engine. In other words, the entire script is parsed and executed by
> > PHP -- there is no "jumping in and out" just because the ?> tag is
> > encountered.
> >
>
> So in that case - PHP engine scans the whole page of text, acting only on
> code it finds between the php start / end tags?
> I guess then I am wondering whether it is more efficient for the PHP engine
> to start / stop it's processing of php code multiple times or whether it is
> more efficient to output ECHO statements between the if conditions? Think
> that I'll put a test page together to test this.
>
> As a side question / answer - what would peoples preference be in this case
> from a view point of understanding / reading / maintaining code be?
>
> M.
One of the php core team covers your original question in her blog,
check it out. In the comments she says the time difference is
nanoseconds
http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html
Re: Readability/easy maintenance, feel free to use one, the other or
both, it depends on what you are doing. I've a slight preference for
inline html but when there's a more php variables to display than html
then I'll usually use echo.
Navigation:
[Reply to this message]
|