Re: is Class::$name doable?
| From: | Matt McClanahan | Date: | Mon, 17 Jul 2000 17:21:57 +0000 |
| Subject: | Re: is Class::$name doable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6937@lists.php.net to get a copy of this message | ||
On Mon, 17 Jul 2000, Teodor Cimpoesu wrote:
> Problem:
> * I want to call a class method by name
> - call_user_method() requires an object
> - call_user_function() doesn't like it
> - $name ='method'; Class::$name() doesn't work.
>
> Is there any other way to do it, or I am constrained to instantiate
> the class?
Starting with PHP4, it's possible to call class methods without
instantiating the class, so Class::methodname() will work. However, I
don't believe you can call Class::$name() the way you want to.
Matt