note 98057 added to language.oop5.static
| From: | JohnInhendersonnv at osu1 dot php dot net | Date: | Mon, 24 May 2010 00:55:44 +0000 |
| Subject: | note 98057 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169537@lists.php.net to get a copy of this message | ||
@ 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
----
Server IP: 64.71.164.2
Probable Submitter: 24.234.125.75
----
Manual Page -- http://www.php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/98057
Del: integrated -- https://master.php.net/note/delete/98057/integrated
Del: useless -- https://master.php.net/note/delete/98057/useless
Del: bad code -- https://master.php.net/note/delete/98057/bad+code
Del: spam -- https://master.php.net/note/delete/98057/spam
Del: non-english -- https://master.php.net/note/delete/98057/non-english
Del: in docs -- https://master.php.net/note/delete/98057/in+docs
Del: other reasons-- https://master.php.net/note/delete/98057
Reject -- https://master.php.net/note/reject/98057
Search -- https://master.php.net/manage/user-notes.php