calling a method of an object at instance creation

Posted by xdevel2000 on Stack Overflow See other posts from Stack Overflow or by xdevel2000
Published on 2010-03-29T09:29:28Z Indexed on 2010/03/29 9:33 UTC
Read the original article Hit count: 376

Filed under:
|

In PHP why can't I do:

class C
{
   function foo() {}
}

new C()->foo();

but I must do:

$v = new C();
$v->foo();

In all languages I can do that...

© Stack Overflow or respective owner

Related posts about php

Related posts about object