note 98057 deleted from language.oop5.static by danbrown
| From: | danbrown@php.net | Date: | Mon, 24 May 2010 01:00:51 +0000 |
| Subject: | note 98057 deleted from language.oop5.static by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169539@lists.php.net to get a copy of this message | ||
Note Submitter: John Inhendersonnv
----
@ myselfasunder at gmail dot com
This is actually the expected behavior. As the manual states:
The pseudo-variable $this is available when a method is called from within an object context. $this
is a reference to the calling object (usually the object to which the method belongs, but possibly
another object, if the method is called statically from the context of a secondary object).
http://us.php.net/manual/en/language.oop5.basic.php
If use error_reporting(E_STRICT), your script will warn against this:
PHP Strict Standards: Non-static method CalledClass::go() should not be called statically, assuming
$this from incompatible context in /path-to-file on line #n