Edit report at http://bugs.php.net/bug.php?id=45724&edit=1
ID: 45724 Updated by: [email protected] Reported by: bastard_man at hotmail dot co dot uk Summary: correct "new Object()->method()" -Status: Open +Status: Duplicate Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: XP/Ubuntu PHP Version: 5.3CVS-2008-08-05 (CVS) Block user comment: N Private report: N New Comment: Duplicate of request #34502. Previous Comments: ------------------------------------------------------------------------ [2008-08-05 12:31:07] bastard_man at hotmail dot co dot uk Description: ------------ Hello, can you help me with a feature change in PHP? in java this code works well AClass object = new AClass().aMethod(); in php it doesnt. It is possible to correct this so the syntax is valid? Reproduce code: --------------- class AClass { public function __construct() {echo("a"); /* return $this; ???? */ } public function method1() {echo("b"); return $this;} public function method2() {echo("c"); return $this;} public static main() {$obj = new TestPhp()->method1()->method2();} } AClass::main(); Expected result: ---------------- abc Actual result: -------------- (Fatal Error) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=45724&edit=1
