Including a whole directory in PHP or Wildcard for use in PHP Include?

MadeinCanada87

New Member
I have a command interpreter in php. It lives inside the commands directory and needs access to every command in the command file. Currently I call require once on each command.\[code\]require_once('CommandA.php');require_once('CommandB.php');require_once('CommandC.php');class Interpreter { // Interprets input and calls the required commands.}\[/code\]Is there someway to include all of these commands with a single require_once? I have a similar problem many other places in my code (with factories, builders, other interpreters). There is nothing but commands in this directory and the interpreter needs every other file in the directory. Is there a wildcard that can be used in require? Such as:\[code\]require_once('*.php');class Interpreter { //etc }\[/code\]Is there any other way around this that doesn't involve twenty lines of include at the top of the file?
 
Back
Top