Re: A moving instance
| From: | Antony Dovgal | Date: | Wed, 30 Jan 2008 16:39:33 +0000 |
| Subject: | Re: A moving instance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35032@lists.php.net to get a copy of this message | ||
On 30.01.2008 18:30, Lars Strojny wrote:
> Hi,
>
> I've recently stumbled upon the following issue: when calling a
> non-static function statically from a non-static class, the instance
> magically moves to the called class. It throws a strict warning, but I
> wonder if this is enough. The attached example produces "Foo".
>
> cu, Lars
Is this what you mean?
"$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 from the context of a secondary object)."
http://www.php.net/manual/en/language.oop5.basic.php
--
Wbr,
Antony Dovgal