例:
<?php
class a{
public function func(){
return "a";
}
}
class b{
public function func(){
return "b";
}
}
$input = "a"; // Would come from user input
eval('$duck = new '.$input.'();');
$duck->func(); // Returns a in this case
を使用せずにこれを行う方法はありますeval()
か?