For example, I have a directory structure like this:
my_stuff
classes
one
two
more
evenmore
manymore
subsub
subsubsub
otherstuff
morestuff
deepstuff
toomuch
and I want to add everything (!) under classes to the php include paths. How would I get such an array? Is there some fancy php func for this?
Recursively iterating over a Directory is easy with SplIterators. You just do
However, do not add each directory to your include path.
If you add all these folders to the include path, you will severely slow down your application. If your class is in subsubsub, PHP will first search in my_stuff, then classes, then one, then two and so on.
Instead have your class names follow the PEAR convention and use autoloading.
See