Re: T_PAAMAYIM_NEKUDOTAYIM
| From: | Sara Golemon | Date: | Mon, 16 Dec 2002 22:31:21 +0000 |
| Subject: | Re: T_PAAMAYIM_NEKUDOTAYIM | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92540@lists.php.net to get a copy of this message | ||
>>> I guess I am going to have to write stupid code such as:
>>>
>>> switch ($param1) {
>>> case 'parser1':
>>> return parser1::method();
>>> case 'parser2':
>>> return parser2::method();
>>> }
>>
>> call_user_func(array($param1, 'method'));
>
> No. Undefined variable this in $param1. Get it ?
>
No. The code you displayed (in the switch block) is 100% identical to the
code Derick offered (except for the fact that Derick's example will handle
any class name while yours is limited).
$classname::method() === call_user_func(array($classname,'method'));
Get it?
-Pollita
P.S. - This thread has gone on long enough, either TRY IT, or take it to
php-general@lists.php.net where it belongs so that they can tell you the
same thing.