note 113954 added to language.oop5.static
| From: | jkenigso at utk dot edu | Date: | Sun, 22 Dec 2013 00:20:51 +0000 |
| Subject: | note 113954 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197996@lists.php.net to get a copy of this message | ||
It bears mention that static variables (in the following sense) persist:
<?php
class StaticVars
{
public static $a=1;
}
$b=new StaticVars;
$c=new StaticVars;
echo $b::$a; //outputs 1
$c::$a=2;
echo $b::$a; //outputs 2!
?>
Note that $c::$a=2 changed the value of $b::$a even though $b and $c are totally different objects.
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/113954
Del: integrated -- https://master.php.net/note/delete/113954/integrated
Del: useless -- https://master.php.net/note/delete/113954/useless
Del: bad code -- https://master.php.net/note/delete/113954/bad+code
Del: spam -- https://master.php.net/note/delete/113954/spam
Del: non-english -- https://master.php.net/note/delete/113954/non-english
Del: in docs -- https://master.php.net/note/delete/113954/in+docs
Del: other reasons-- https://master.php.net/note/delete/113954
Reject -- https://master.php.net/note/reject/113954
Search -- https://master.php.net/manage/user-notes.php