note 100043 added to language.oop5.static
| From: | Quoctuan261 at gmail dot com | Date: | Tue, 21 Sep 2010 18:32:29 +0000 |
| Subject: | note 100043 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172725@lists.php.net to get a copy of this message | ||
class MyCounter{
public function count(){
static $count=0;
return $count++;
}
}
$c=new MyCounter();
$c->count()//0
$c->count()//1
$c=new MyCounter();
$c->count()//2
I don't know why.
----
Server IP: 69.147.83.197
Probable Submitter: 1.53.166.89
----
Manual Page -- http://www.php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/100043
Del: integrated -- https://master.php.net/note/delete/100043/integrated
Del: useless -- https://master.php.net/note/delete/100043/useless
Del: bad code -- https://master.php.net/note/delete/100043/bad+code
Del: spam -- https://master.php.net/note/delete/100043/spam
Del: non-english -- https://master.php.net/note/delete/100043/non-english
Del: in docs -- https://master.php.net/note/delete/100043/in+docs
Del: other reasons-- https://master.php.net/note/delete/100043
Reject -- https://master.php.net/note/reject/100043
Search -- https://master.php.net/manage/user-notes.php