note 79611 deleted from language.oop5.autoload by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:15:40 +0000 |
| Subject: | note 79611 deleted from language.oop5.autoload by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218041@lists.php.net to get a copy of this message | ||
Note Submitter: richard [at ] xanox [dot] net
----
I've made this little script here which looks in a dir, and loads all the classed, and includes
their files.
$myDirectory = opendir("required/classes");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
sort($dirArray);
for($index=0; $index < $indexCount; $index++) {
if($dirArray[$index] != '.' AND $dirArray[$index] != '..') {
include("required/classes/$dirArray[$index]");
$classname = strtolower($dirArray[$index]);
$classname = str_replace('.php','',$classname);
$classinit = str_replace('.php','',$dirArray[$index]);
$$classname = new $classinit;
}
}