note 46878 deleted from function.include by sean

From: Date: Tue, 26 Oct 2004 20:58:27 +0000
Subject: note 46878 deleted from function.include by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79140@lists.php.net to get a copy of this message
Note Submitter: Rob Loach (http://robloach.net) ---- To include all files inside a given directory: <?php /******************************************************** * Title: IncludeAllFilesInDir * Author: Rob Loach (http://robloach.net) * Date: October 26, 2004 * Info: Includes all files in the given top directory. ********************************************************/ function includeAllFilesInDir($dir){ if ($handle = opendir($dir)){ while ($file = readdir($handle)) if (is_file("$dir/$file")) $filesArr[] = trim($file); closedir($handle); foreach($filesArr as $file) include("$dir/$file"); } } // To now include all the files in the "includes" directory, do the following: includeAllFilesInDir("includes"); ?> ---- Reason: useless example

« previous php.notes (#79140) next »