You are here: Re: Performance of lots of ECHO's V Jumping In/Out of PHP « PHP Programming Language « IT news, forums, messages
Re: Performance of lots of ECHO's V Jumping In/Out of PHP

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация