note 76989 added to language.oop5.static

From: Date: Thu, 09 Aug 2007 08:54:58 +0000
Subject: note 76989 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-129365@lists.php.net to get a copy of this message
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" ?> ---- Server IP: 69.147.83.197 Probable Submitter: 193.30.224.94 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.static.php Edit -- https://master.php.net/note/edit/76989 Del: integrated -- https://master.php.net/note/delete/76989/integrated Del: useless -- https://master.php.net/note/delete/76989/useless Del: bad code -- https://master.php.net/note/delete/76989/bad+code Del: spam -- https://master.php.net/note/delete/76989/spam Del: non-english -- https://master.php.net/note/delete/76989/non-english Del: in docs -- https://master.php.net/note/delete/76989/in+docs Del: other reasons-- https://master.php.net/note/delete/76989 Reject -- https://master.php.net/note/reject/76989 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129365) next »