I\'m trying to make some kind of function that loads and instantiates a class from a given variable. Something like this:
You can use call_user_func():
$class = call_user_func(array($class, 'getInstance'));
The first argument is a callback type containing the classname and method name in this case.