On Wed, Mar 11, 2009 at 3:16 PM, Olivier Doucet <webmas...@ajeux.com> wrote:
> Hello, > > I posted the same topic on the general mailing list, but it appears this > can > be posted here, as it is open to feedbacks and is about PHP implementation > of static functions. > > I'm wondering if the following behaviour is a bug or a feature. The case is > quite complex, so let me explain my point of view. > here is the source : > > <?php > > class MyTest { > public function myfunc() { > echo get_class($this); > } > } > class MySecondTest { > public function test() { > MyTest::myfunc(); > } > } > > $test = new MySecondTest(); > $test->test(); //output: "MySecondTest" > > ?> not sure if this was mentioned on the general list but, i believe what youre describing is documented in the manual under php5 classes/objects -> "the basics": http://www.php.net/manual/en/language.oop5.basic.php $this is a reference to the calling object (usually the object to which the method belongs, but can be another object, if the method is called statically <http://www.php.net/manual/en/language.oop5.static.php> from the context of a secondary object). -nathan