I have a command interpreter in php. It lives inside the command directory and needs access to each command in the command file. I am currently calling the request once for each command.
require_once('CommandA.php'); require_once('CommandB.php'); require_once('CommandC.php'); class Interpreter {
Is it possible to include all these commands with one require_once? I have a similar problem with 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 a requirement? For example:
require_once('*.php'); class Interpreter {
Is there another way that doesn't include twenty include lines at the top of the file?
include php wildcard require
Daniel Bingham
source share