|
Posted by olivier on 10/20/00 11:19
Hi,
Try something like:
$classname = "MyClass";
$construct_params = array("param1","param2","param3");
$return =null;
if(class_exists($classname)){
$param=explode(" ',' ", $construct_param);
# You must add here some security checks....
eval("$retrun = new $className($param)");
var_dump($return);
}
Hope this help!
Olivier
Le Mercredi 22 Juin 2005 05:33, Eli a écrit :
> Hi,
>
> I want to create an object in a form that I get the class name and its
> parameters, and I need to create that object...
> How can this been done?
>
> i.e:
> $classname = "MyClass";
> $construct_params = array("param1","param2","param3");
> /* Now create the object with the given classname and params... how? */
>
> -thanks, Eli
Navigation:
[Reply to this message]
|