Re: T_PAAMAYIM_NEKUDOTAYIM

From: Date: Mon, 16 Dec 2002 21:00:52 +0000
Subject: Re: T_PAAMAYIM_NEKUDOTAYIM
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-92537@lists.php.net to get a copy of this message
<derick@php.net> wrote : > On Mon, 16 Dec 2002, Bertrand Mansion wrote: > >> And keep an access to $this from inside the object calling the external >> method because my parsing is actually recursive. > > $this only works for instanciated classes, not static method calls. From the documentation, http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php "...Thus, when used from WITHIN an object function, you may use $this and object variables." This is the exact behaviour I need for my class to work. :: is really one of the coolest features of PHP. I don't see why $className::method() can't work, this is not very logical when you know that $method() works and $a = new $b() works too. Even $className::$method() should work :) OK, I understood it's not implemented and won't be anytime soon. I guess this is because of some obscure reasons that go far over my comprehension but because of that, I am going to be stuck with this class. I guess I am going to have to write stupid code such as: switch ($param1) { case 'parser1': return parser1::method(); case 'parser2': return parser2::method(); } Don't laugh at me, it's not funny :) Bertrand Mansion Mamasam

« previous php.dev (#92537) next »