note 33376 added to function.readdir

From: Date: Tue, 24 Jun 2003 13:15:16 +0000
Subject: note 33376 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-50926@lists.php.net to get a copy of this message
This handy script will include all the class files in a given subdirectory from the current folder where the script is running: <? php $class_dir= dirname(__FILE__)."/Classes/"; $class_directory_handle = opendir($class_dir); while (false !== ($filename = readdir($class_directory_handle) ) ) { if (preg_match('/\.class\.php$/i', $filename) ) { // We have a match, this is a file we include. require_once($class_dir.$filename); } } closedir($class_directory_handle); ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33376 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33376&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33376&report=yes

« previous php.notes (#50926) next »