You are here: Re: [PHP] Help with a home-grown function « PHP « IT news, forums, messages
Re: [PHP] Help with a home-grown function

Posted by Matthew Weier O'Phinney on 11/13/50 11:22

* "Ford, Mike" <M.Ford@leedsmet.ac.uk> :
> On 21 July 2005 22:19, Chris W. Parker wrote:
>
> > 2. It will be a good idea to get out of the habit of breaking in and
> > out of PHP like that. Instead just do: echo 'hi1';
>
> Why? Some of us just strongly prefer the breaking in and out style -- I use
> it almost exclusively. In my 10,000s of lines of code, you can probably
> count the number of echos on your fingers!
>
> > You'll have problems down the road with modifying the headers
> > (cookies, redirects, content-type, etc.) if you break in and out.
>
> Absolute rubbish -- whatever gives you this idea? The sequence
>
> ?> x<?php
>
> Is functionally identical to
>
> echo 'x';
>
> so anything that works with the latter will work identically with the
> former.

I disagree with both statements. Echoing and breaking out of PHP are
typically both undesirable in large applications where you may wish to
change headers. Capture your output into a variable and send it to
output once all processing is done. This may be done using output
buffering or other techniques.

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

 

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

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