note 109310 deleted from language.variables.scope by crell

From: Date: Thu, 31 Mar 2022 19:42:15 +0000
Subject: note 109310 deleted from language.variables.scope by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217936@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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

« previous php.notes (#217936) next »