I'd like to be able to call a static object through a variable - I'm wondering how to do that. To give an example:
Code: Select all
function ($className) {
$singleton = $className::getInstance();
}So if $className = 'exampleClass', how do I get PHP to read that line as 'className::getInstance()'?
Many thanks,
- JB