我想要这样的东西,但动态来自这样的数组:
$array = array("first","second","third");
所以这个类会被这样调用:
$class = new class("first","second","third");
答案 0 :(得分:3)
您可以使用反射:
$refClass = new ReflectionClass('SomeClass');
$instance = $refClass->newInstanceArgs($args);