Re: static class member resolution

From: Date: Sat, 16 May 2015 17:16:27 +0000
Subject: Re: static class member resolution
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-324905@lists.php.net to get a copy of this message
That’s good news. Thanks Regards > On May 16, 2015, at 20:25, Christoph Becker <cmbecker69@gmx.de> wrote: > > Loknath Bharti wrote: > >> I have the following in a class : >> >> $this->modelHandler = Handler; >> $this->modelHandler::staticMethod(); >> >> I am receiving a parse error problem in the second line. >> >> Handler is a class definition, and staticMethod is a static method. Handler is assigned to >> class variable modelHandler, but the above will return a parse Error. At the same time if I assign >> $this->modelHandler to a variable and call the staticMethod on that it works without a problem. I >> would like to make the above work, because its superfluous to have to assign a class Variable to a >> local variable to access it. >> >> $this->modelHandler = Handler; >> $handler = $this->modelHandler; >> $handler::staticMethod(); >> >> The above works. Any insight into resolution by using something like >> {$this->modelHandler}::Handler would be appreciated. > > You'll probably have to wait for PHP 7.0.0: <http://3v4l.org/mkPYYB > J,ªNo!½º_4¼´ <http://3v4l.org/mkPYY>>. :) > > -- > Christoph M. Becker

« previous php.general (#324905) next »