|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-11-23 10:33 UTC] aharvey@php.net
-Status: Open
+Status: Duplicate
-Package: Feature/Change Request
+Package: *General Issues
[2010-11-23 10:33 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
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)