Re: Help with a home-grown function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* "Ford, Mike" <M.Ford@xxxxxxxxxxxxxx> :
> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux