Re: [PHP] functions, opinion...

2003-06-17 Thread Jason Wong
On Tuesday 17 June 2003 12:50, DvDmanDT wrote: I was replying to If you don't do it this way, you'll find yourself re-writing a function sooner or later because you need it to return the data instead of displaying it Then you don't need to modify the function if you turn on ob, call

Re: [PHP] functions, opinion...

2003-06-17 Thread SLanger
Depends on the use of the function. (Output functions should produce output shouldn't they?!) Best option probably is to specifiy an argument that allows to choose wether to output or to return. If you return text you should return by reference to prevent unnecessary memory consumption.

Re: [PHP] functions, opinion...

2003-06-17 Thread Lars Torben Wilson
On Mon, 2003-06-16 at 23:20, Jason Wong wrote: On Tuesday 17 June 2003 12:50, DvDmanDT wrote: I was replying to If you don't do it this way, you'll find yourself re-writing a function sooner or later because you need it to return the data instead of displaying it Then you don't need to

RE: [PHP] functions, opinion...

2003-06-17 Thread Dan Joseph
Hi, 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

RE: [PHP] functions, opinion...

2003-06-17 Thread Dan Joseph
Hi, Depends on the use of the function. (Output functions should produce output shouldn't they?!) Best option probably is to specifiy an argument that allows to choose wether to output or to return. If you return text you should return by reference to prevent unnecessary memory consumption.

Re: [PHP] functions, opinion...

2003-06-17 Thread Hugh Bothwell
Dvdmandt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Now, where did those two paragraphs come from? A bit of experience with all those langs and the BASIC school... I'm at the age of 14 and don't even know math yet so (I mean, I know +, -, / and *, but not advanced stuff)...

Re: [PHP] functions, opinion...

2003-06-16 Thread Rolf Brusletto
Dan - 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

Re: [PHP] functions, opinion...

2003-06-16 Thread John W. Holmes
Rolf Brusletto wrote: 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

Re: [PHP] functions, opinion...

2003-06-16 Thread DvDmanDT
Or you could just temporarily enable ob... That's what I do when I have a function that needs to return lots of HTML containing many ' and ... I know it's possible to use \ as well, but ob is somewhat easier then... John W. Holmes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Rolf

Re: [PHP] functions, opinion...

2003-06-16 Thread Hugh Bothwell
Dvdmandt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Or you could just temporarily enable ob... That's what I do when I have a function that needs to return lots of HTML containing many ' and ... I know it's possible to use \ as well, but ob is somewhat easier then... You're

Re: [PHP] functions, opinion...

2003-06-16 Thread Leif K-Brooks
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

Re: [PHP] functions, opinion...

2003-06-16 Thread DvDmanDT
I was replying to If you don't do it this way, you'll find yourself re-writing a function sooner or later because you need it to return the data instead of displaying it Then you don't need to modify the function if you turn on ob, call function, then get contents, then clear ob... Ok, it's a