My personal opinion, which shows in all my code writing is to never echo inside a function. always return the data whether it be string, array, or boolean... I've always left echoing up to the actual page showing the data. That way if you have two seperate pages that need to display the data differently, you can use the same function, and just format it as needed on the pages.
Rolf Brusletto http://www.phpExamples.net
Dan Joseph wrote:
Hi,
Just kind of curious what people think. In your opinion, should a function avoid output? What I mean by that, is should a function on "do something" without having echo or printf commands in it? This is something I've been thinking about lately to improve my programming style. Opinions?
-Dan Joseph
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php