Eli wrote:
Jochem Maas wrote:
Eli wrote:
I believe that this is the kind of clever, evil stuff the OP was
trying to avoid...
(evil - eval :-) - besides eval is very slow - not something you (well
me then) want to
use in a function dedicated to object creation which is comparatively
sl
Thomas Angst wrote:
Eli schrieb:
You're right that using eval() slows.. But using the _init() function
as you suggested is actually tricking in a way you move the
constructor params to another function, but the initialization params
should be sent to the constructor!
I guess that it would b
Eli schrieb:
You're right that using eval() slows.. But using the _init() function
as you suggested is actually tricking in a way you move the
constructor params to another function, but the initialization params
should be sent to the constructor!
I guess that it would be better if PHP will
Jochem Maas wrote:
Eli wrote:
I believe that this is the kind of clever, evil stuff the OP was trying
to avoid...
(evil - eval :-) - besides eval is very slow - not something you (well
me then) want to
use in a function dedicated to object creation which is comparatively
slow anyway
(try
Eli wrote:
Thomas Angst wrote:
> Thanks for you answer, but sorry, I do not understand your hint. I tried
> this code:
> class test {
>var $txt;
>function test($txt) { $this->txt = $txt; }
>function out() { echo $this->txt; }
> }
> $obj = call_user_func_array(array('test', 'te
Thomas Angst wrote:
> Thanks for you answer, but sorry, I do not understand your hint. I tried
> this code:
> class test {
>var $txt;
>function test($txt) { $this->txt = $txt; }
>function out() { echo $this->txt; }
> }
> $obj = call_user_func_array(array('test', 'test'), array('foobar'
Matthew Weier O'Phinney schrieb:
Use the func_* functions, along with array_shift(). In addition, you'll
need to use either a standard-named static instantiator, or the class
name as the constructor method:
function create($class) {
$args = func_get_args();
array_shift($args); // remove $
* Thomas Angst <[EMAIL PROTECTED]>:
> I would like to create an object inside a function with its classname
> and a parameter list submitted by the function call.
>
> function create($class, $parameter) {
> $obj = new $class($parameter);
> return $obj;
> }
>
> This is working very well. Bu
8 matches
Mail list logo