When you include() a file that contains a series of functions then PHP will
parse the whole file, which means all the functions contained within that
file. PHP does not wait until you actually call a function to parse it. If
there are functions that are loaded but not used this may seem like an
unnecessary overhead, but if you put each function into a separate file you
should be aware of the following:
(a) If each function is in a separate file then you will have to remember to
include() it before you can use it.
(b) The time taken to open and load a file is greater than the time taken to
parse the contents of a file, so having a dozen functions in a single file
is quicker than loading a dozen functions from a dozen files.
What I actually do is to split my functions into groups and put all
functions within the same group into the same file, thus I have one file for
session functions, another for XML/XSL functions and so on.
HTH.
--
Tony Marston
http://www.tonymarston.net
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:40***********************@news.xs4all.nl...
Hi group,
[concerning PHP4.3]
I have an includefile that I (ahum) include in many scripts.
It contains only functions I need now and then.
Now I was wondering how things work behind the scenes.
Is the whole file loaded and compiled/interpreted every time a php-file is
used that includes this file?
That would be an unwanted extra load for my server.
If so, I should consider splitting up that file in some smaller files, but
that is of course extra overhead for me.
I have no idea how this works.
Can anybody enlighten me?
Thanks for your time!
Regards,
Erwin Moller