note 113913 added to language.variables.scope
| From: | JonathanKenigson | Date: | Mon, 16 Dec 2013 23:09:35 +0000 |
| Subject: | note 113913 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197955@lists.php.net to get a copy of this message | ||
Just a note about static properties declared at class level:
class Test_Class {
static $a = 0;
public function ReturnVar(){
return $this->a;
}
}
$b = new Test_Class();
echo $b->ReturnVar();
Will not output "0" because $a is declared static. Changing "static" to
"public" or "private" will produce the output "0".
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/113913
Del: integrated -- https://master.php.net/note/delete/113913/integrated
Del: useless -- https://master.php.net/note/delete/113913/useless
Del: bad code -- https://master.php.net/note/delete/113913/bad+code
Del: spam -- https://master.php.net/note/delete/113913/spam
Del: non-english -- https://master.php.net/note/delete/113913/non-english
Del: in docs -- https://master.php.net/note/delete/113913/in+docs
Del: other reasons-- https://master.php.net/note/delete/113913
Reject -- https://master.php.net/note/reject/113913
Search -- https://master.php.net/manage/user-notes.php