PHP List,
Up until now, in order to get all the functions and classes I need in my
scripts, I have always made a file called "includes.php" that contains a
series of include() statements for all of the files that I want to
include. Then I just include that one file at the top of all my PHP scripts.
This system works okay, but I thought it would be better to have a
consistent naming standard, and use some kind wild card or loop to
include all the files I want. That way I can change, add, and remove
files a little easier.
All the files I want to include end with either ".class", or with
"_fns.php". ("fns" stands for "functions".)
It seems that wildcard characters are not supported in the include()
function. Some experiments and a search on the web seem to confirm this.
So then I thought what I need to do is use the readdir() function
somehow, and make an array of all files ending in ".class" or
"_fns.php", and then make a while or foreach loop to include every
required file.
I couldn't quite figure out how to do that, but in any case I wondered
if running this loop at the start of every single PHP script might be
unnecessary overhead. After all, the list of included files will only
change when I work on the system. It's not going to vary at all based on
any kind of user input or in standard usage of my web site.
What would be the recommended way of including files that will change as
I work on the system? Do most people create a function to detect the
included files, or do most people make a static list that they edit by hand?
--
Dave M G
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php