On Tue, June 21, 2005 8:33 pm, Eli said:
> 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");
> /*
olivier wrote:
Sorry for typo error, just need my cup of cofee...
:-) no probs ... I think we gave the OP plenty to think about!
liked you 'Register' idea - seems like it could work well.
also nice one for pointing out my php5isms - I forget that alot
of stuff I use is php5 only (e.g. second t
Sorry for typo error, just need my cup of cofee...
Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php
-> see:
from taylor
08-May-2005 12:04
-> using eval.
I dont like eval too but i think that is depending on the pb we want to
solve... if you can change contruto
-- Message transmis --
Subject: Re: [PHP] variable object creating
Date: Mercredi 22 Juin 2005 14:19
From: olivier <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sorry for typo error, just need my cup of cofee...
Here is a good post for:
http://fr.php.net/man
Sorry for typo error, just need my cup of cofee...
Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php
from taylor
08-May-2005 12:04
###
olivier wrote:
Hi,
I answered this also, but apparently I only replied to the OP...
(reproduced here - minus the typos in my first post on this topic :-/)
if (class_exists($className, false)) {
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}
Try something
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($
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...
8 matches
Mail list logo