You are here: Re: Singleton « PHP Programming Language « IT news, forums, messages
Re: Singleton

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация