I've been using PHP basically for a while now, but just starting to get up to date with OOP in PHP5 really.
One question I have is regarding functions as I'm starting to use them more and more. I seem to have it in my head that functions should not output directly to the screen, e.g. using echo, print etc, but should always just return what ever value to where the function was called from.
I'm now trying to setup some basic classes for use on my site, and want a pageBuilder class that generates valid page html headers and footers.
I can see two ways of doing this:
1) echo all the out put from the function, a line at a time
2) build up a pageHeader variable within the function, and then just return this one variable at the end of the function.
Anybody got any thoughts on this?
Thanks in advance for any help 🙂