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 co
It's 2015 now, so you're most likely running PHP >= 5. If so, as mentioned a couple of times above, PHP's autoload capability is a good solution, probably the best. It was created specifically so you won't have to write a utility function for auto loading. However, as mentioned in the PHP docs, __autoload is no longer recommend and may be depreciated in future versions. As long as you're using PHP >= 5.1.2, use spl_autoload_register instead.