This is a syntax question I think... I have an array of classnames, that I use in a factory to generate objects by object type code:
$array = ['a' => '
amespace\AClass', 'b' => '
amespace\BClass'];
I can instantiate these classes from the string name just fine:
$classname = $array['a'];
return new $classname($arg1, $arg2);
What I am trying to do is call a static method of the class named in the array or string, without having to initialize the object - something like:
$classname = $array['a'];
return $classname::formatArg($arg1);
Obviously, this doesn't work since $classname is a string, so how do I tell PHP I am trying to access the object with that name?