Brent Baisley wrote:
Not sure which is faster, you would have to run a quick test to truly
see. From a design standpoint, I would put the function in a class and
load the class early in the file. You can then override the function,
make changes to the number of parameters or other "flexibility" actions.
The function also has it's own variable scope, which can be very helpful
depending on what you are doing. You can't do that with an included file.
a bit irrelevant and also not true IMHO. besides the question was about speed,
he is already looking at possibly incurring the overhead of a function call
(It doesn't sound like he can use the include option is his case), why make
it slower by adding a class into the mix (class/object method calling incurs
a slightly greater overhead)?
If you do use and include, you most certainly should use include_once
instead, unless you are dependent on changing/new variables in the loop.
which he obviously is?! so he most certainly shouldn't be using include_once,
but I think he gets that also.
On Jun 9, 2005, at 12:15 PM, Brian Dunning wrote:
I have an include file with about 6 lines of code, just text parsing.
If I have to loop through 5000 records, is there a big difference
between (a) calling this include file 5000 times, and (b) defining a
function and just calling the function 5000 times?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php