I need to pass a variable number of strings to instantiate different classes. I can always do a switch on the size of the array:
switch(count($a)) { case 1:
have a look at the factory design pattern:
class Factory { public static function CreateInstance($args) { switch(func_get_num_args()) { case …: return new ClassA(…); break; case …: return new ClassB(…); break; } } }