Page 1 of 1

new keyword combined with other things.

Posted: Mon Dec 06, 2010 10:30 am
by drealecs
how can this be write:

$result = new Object() -> method();

I've tried with parenthesis around new but nothing.
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?

Re: new keyword combined with other things.

Posted: Mon Dec 06, 2010 10:49 am
by AbraCadaver
drealecs wrote:how can this be write:

$result = new Object() -> method();

I've tried with parenthesis around new but nothing.
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?
No. I don't know why, you can post on the php.internals mailing list.