note 109310 added to language.variables.scope

From: Date: Wed, 04 Jul 2012 23:54:24 +0000
Subject: note 109310 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-189034@lists.php.net to get a copy of this message
It will be obvious for most of you: changing value of a static in one instance changes value in all instances. <?php class example { public static $s = 'unchanged'; public function set() { $this::$s = 'changed'; } } $o = new example; $p = new example; $o->set(); print "$o static: {$o::$i}\n$p static: {$p::$i}"; ?> Output will be: $o static: changed $p static: changed ---- Server IP: 69.147.83.197 Probable Submitter: 77.254.139.97 ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- https://master.php.net/note/edit/109310 Del: integrated -- https://master.php.net/note/delete/109310/integrated Del: useless -- https://master.php.net/note/delete/109310/useless Del: bad code -- https://master.php.net/note/delete/109310/bad+code Del: spam -- https://master.php.net/note/delete/109310/spam Del: non-english -- https://master.php.net/note/delete/109310/non-english Del: in docs -- https://master.php.net/note/delete/109310/in+docs Del: other reasons-- https://master.php.net/note/delete/109310 Reject -- https://master.php.net/note/reject/109310 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189034) next »