I am using a lot of include files to include my 191 files of with the collection of functions, classes ect.
A problem for me is I really dislike editing the include files its gets a big mess and sometime i just forget to include something.
Therefore I was wondering, is there a include function for php or own made library that includes all the php files in a folder or even better in its own folder + all its sub-folders.
These things make life much easyer and flexible.
You can use the following function i just created:
START EDIT
This is the new version of the same function. Now it allows you to specify folders as
folderorfolder/without crashing. Also now it loads all files in all folders and subfolders.END EDIT
You can also specify a specific extension if you want to load for example only
.txtfiles in a folder you can execute is like this:load_folder('folder/', '.txt');.Remember that someone think that this is somehow insecure. Before using this function inside a business site, look for more opinion about the topic.
Notice also that if some of your files are regarding classes you could use the
__autoload()PHP native function to let PHP call the class where it is really needed (lazy loading).References: