note 108938 deleted from language.oop5.cloning by cmb

From: Date: Sun, 10 Jul 2016 20:11:38 +0000
Subject: note 108938 deleted from language.oop5.cloning by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-205955@lists.php.net to get a copy of this message
Note Submitter: seriously at something dot com ---- If you want a property that gets the same value in every clone if changed, you can do this simple trick: <?php class A { public static $name ; } $a = new A; $a::$name = 'George'; $b = clone $a; $b::$name = "Somebody else"; echo 'a: ' . $a::$name . "\n"; echo 'b: ' . $b::$name . "\n"; ?> this will output: a: Somebody else b: Somebody else You can change any of the clones property and all of the others will change accordingly.

« previous php.notes (#205955) next »