$classes) { foreach ($classes as $name) { $class = '\\'.$namespace.'\\'.$name; $container[lcfirst($name)] = function ($c) use ($class) { return new $class($c); }; } } } }