note 76989 deleted from language.oop5.static by cmb

From: Date: Sun, 01 Sep 2019 07:17:48 +0000
Subject: note 76989 deleted from language.oop5.static by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212043@lists.php.net to get a copy of this message
Note Submitter: Clment Genzmer ---- The best solution I found for the non-inherited static problem : pass the name of the class. <?php class A { public static $my_vars = "I'm in A"; static function find($class) { $vars = get_class_vars($class) ; echo $vars['my_vars'] ; } } class B extends A { public static $my_vars = "I'm in B"; } B::find("B"); // Result : "I'm in B" ?>

« previous php.notes (#212043) next »