|
Posted by David Haynes on 12/18/58 11:50
AlexVN wrote:
> Henk,
>
> Thank you for the great answer. You are right--I'm looking for a method
> of instantiating class with dynamic parameters, not creating. I
> understant the method you proposed, but what I would much rather see is
> a method of calling class constructor with dynamic number of
> parameters. I suspect that PHP does not have such method (since you, a
> guru, do not listed it here) and will try to create a couple of ifs for
> my case.
>
> Thanks,
> Alexander
> http://www.alexatnet.com/
I know its not quite what you had in mind (i.e. polymorphism) but I have
had some success with passing an associative array to a class
constructor and then letting the constructor figure out what to do. This
is a bit different from the $foo = null type of setup since you may
supply any number of keys in the associative array but undefined keys
have no value.
-david-
[Back to original message]
|