note 85277 added to language.oop5.static
| From: | MathijsVos at osu1 dot php dot net | Date: | Sat, 23 Aug 2008 10:53:05 +0000 |
| Subject: | note 85277 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143765@lists.php.net to get a copy of this message | ||
<?php
class foo
{
public static $myStaticClass;
public function __construct()
{
self::myStaticClass = new bar();
}
}
class bar
{
public function __construct(){}
}
?>
Please note, this won't work.
Use self::$myStaticClass = new bar(); instead of self::myStaticClass = new bar(); (note the $ sign).
Took me an hour to figure this out.
----
Server IP: 83.137.20.135
Probable Submitter: 213.46.37.68
----
Manual Page -- http://www.php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/85277
Del: integrated -- https://master.php.net/note/delete/85277/integrated
Del: useless -- https://master.php.net/note/delete/85277/useless
Del: bad code -- https://master.php.net/note/delete/85277/bad+code
Del: spam -- https://master.php.net/note/delete/85277/spam
Del: non-english -- https://master.php.net/note/delete/85277/non-english
Del: in docs -- https://master.php.net/note/delete/85277/in+docs
Del: other reasons-- https://master.php.net/note/delete/85277
Reject -- https://master.php.net/note/reject/85277
Search -- https://master.php.net/manage/user-notes.php