Calling static object via variable?
Posted: Fri Sep 25, 2009 1:40 pm
Hi gang,
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:
Of course, this returns an "unexpected T_PAAMAYIM_NEKUDOTAYIM" error.
So if $className = 'exampleClass', how do I get PHP to read that line as 'className::getInstance()'?
Many thanks,
- JB
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