note 47310 deleted from language.oop5.paamayim-nekudotayim by aidan

From: Date: Mon, 15 Nov 2004 14:10:48 +0000
Subject: note 47310 deleted from language.oop5.paamayim-nekudotayim by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80541@lists.php.net to get a copy of this message
Note Submitter: Joscha Feth <joscha at feth dot com> ---- Someone might need to make a static function call to a class of which the name is only available in a variable: <?php class Foo { public static $bla = array('a','b'); public static function getBla() { return self::$bla; } } //~ works as desired print_r(Foo::getBla()); $classname = 'Foo'; //~ gives a parse error 'T_PAAMAYIM_NEKUDOTAYIM' print_r($classname::getBla()); //~ not nice, but works print_r(eval("return $classname::getBla();")); ?>

« previous php.notes (#80541) next »