[Sussex] PHP Question: How to include all files in a directory

Matthew Macdonald-Wallace matthew at truthisfreedom.org.uk
Sun Feb 13 19:37:10 UTC 2005


On Sun, 13 Feb 2005 13:05:14 +0000
Steve Dobson <steve at dobson.org> wrote:

> Hi PHP Guru
> 
> I am developing a little PHP system and I want to make it easy
> for users/SysAdmins to add their own functions PHP extension routes.
> 
> Is there any way of "require_once('lib/functions/*.php');" so that
> all the user has to do is install his functions in the lib/functions
> dir and the system will automatically pick them up.

Steve,

You could create a file called include.php and have it do the following:

foreach($fileList)
{
	require_once("filename")
}

and then just:

require_once("include.php");

bear in mind this is pseudo-code and could be extremely server intensive, but it is one way I can think of!

Matt




More information about the Sussex mailing list