Hey guys, Im having a problem with using a variable as the class name when calling a static function within the class. My code is as follows:
class test {
static function getInstance() {
return new test();
}
}
$className = "test";
$test = $className::getInstance();
Ive got to define the class name to a variable as the name of the class is coming from a database so i never know what class to create an instance of.
note: currently i am getting the following error:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
Thanks