I'm having a problem using a variable as a class name when calling a static function inside a class. My code is as follows:
class test {
static function getInstance() {
return new test();
}
}
$className = "test";
$test = $className::getInstance();
I need to determine the class name for the variable, since the class name comes from the database, so I never know which class to instantiate.
note: I am currently getting the following error:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
thank
source
share