|
Posted by Rik Wasmus on 01/24/08 23:08
On Thu, 24 Jan 2008 23:44:16 +0100, Shelly <sheldonlg@thevillages.net> =
wrote:
> On Jan 24, 5:07 pm, Shelly <sheldo...@thevillages.net> wrote:
>> I found that in PHP5 the following does not work:
>>
>> $a =3D "Foo";
>> $b =3D $a::getStaticMethod();
>>
>> I've tried {$a}::getStaticMethod(); and a few other things. Lookin=
g
>> in the manual, Example 2 is just this. However, a user posted on Jan=
,
>> 4 that this doesn't work (just as I found out today). Is this a bug?=
>>
>> Does anyone have a work-around? (I am not looking forward to doing a=
n
>> eval instead).
>>
>> Shelly
>
> An eval worked.
Eval is evil.
I could have sworn it would work as the example BTW, apparantly not. =
Preferable to eval would be:
$b =3D call_user_func(array($a,'getStaticMethod'),$and,$some,$arguments)=
;
or
$b =3D =
call_user_func_array(array($a,'getStaticMethod'),array($and,$some,$argum=
ents));
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|