You are here: Re: [PHP] variable object creating « PHP « IT news, forums, messages
Re: [PHP] variable object creating

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация