Re: Using variable content to name a class
| From: | Jochem Maas | Date: | Tue, 06 Jun 2006 12:14:45 +0000 |
| Subject: | Re: Using variable content to name a class | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237455@lists.php.net to get a copy of this message | ||
Dave M G wrote:
> Chris,
>
> Thank you for replying.
>>> $object = new $className();
>>> Is this possible?
>> If in doubt, test it out ;)
>> Yes, it will work.
> Oh, that's actually the code I can use? I just wrote it as an
> explanatory aid, not thinking that it could be literally done like that.
> I assumed there was a specific command I was missing.
>
> Well, anyway, I guess I've stumbled on the right syntax. Thank you for
> pointing it out to me.
also check out call_user_func() and call_user_func_array() - you might
find them handy in certain situations.
>
> --
> Dave M G
>