Say I have a class Core() where it will give me the instance of different classes depending on some initialization. Say that after initiating it, I get some class and then want to instantiate that. This is what I do:
$core = new Core(); // $core is further initiated $api = $core->getClass(); // This returns, for instance class Library_MyClass $class = new $api(); Is there a way to combine the last two steps into one? So for instance I say something like $class = new $core->getClass()()? Obviously what I wrote is wrong, but that is sort of what I want! Is that possible?