Is there a way to call Static Classes / Methods by name?
Example:
$name = 'StaticClass';
($name)::foo();
I have classes which I keep all static methods in and I'd like to call them this way.
$name::foo()
is possible since PHP5.3. In earlier versions you have to use
call_user_func(array($classname,$methodname))
call_user_func. There's also call_user_func_array. See php.net.You can do something like this using the call_user_func function
it would look something like the following
$name = 'staticClass';
call_user_func(array($name, 'foo'));
Hope this helps