|
Posted by M. Trausch on 11/17/05 06:18
sam wrote:
>
> $db = new $class_name ($user, $pwd, $dbName);
>
> Now, PHP knows that $class_name is a variable that contains the name of the
> class. That why it should work.
>
Hrm.
I didn't realize that you could use a variable like that in PHP. That's
a pretty nifty feature, actually. I never tried it quite like that,
probably because I'm thinking too much like I'm working in other
languages. What I wound up doing was working with eval(); and taking
advantage of PHP's variable substitution within double-quoted strings to
achieve the same effect, which worked rather nicely. I'll have to keep
this in mind for the future, though. That's pretty cool.
Thanks,
Mike
--
Strip the obvious trash from the header to send e-mail.
[Back to original message]
|