Example:
<?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
Is there any way I can do this without using eval()?
 
     
    