Re: new keyword combined with other things...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try with



$result = Object::method();

this is a static method in a class.

the operator -> is access to a member in an object.

Gerardo.





On Tue, Dec 7, 2010 at 12:40 PM, Alexandru Patranescu <drealecs@xxxxxxxxx>wrote:

> In many other languages this will work:
>
> *$result = new Object() -> method();*
>
> But in php, it fails at parsing.
> I've tried with parenthesis around new but nothing. Anyhow, as I saw later,
> *new* operator has precedence over others so this couldn't be a solution.
> I know a static function can be defined and the above statement can
> transform into
>
> *$result = Object::getNewInstance() -> method()*
>
> but is there any way to write it directly? and if not, why isn't this
> implemented yet and when will it be?
>
> best regards,
> Patranescu Alexandru
>



-- 
Gerardo Benitez
-------------------------
www.webseficientes.com.ar
Diseño web, programación, Seo

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux