note 33374 deleted from language.oop by aidan

From: Date: Sat, 03 Jul 2004 14:53:20 +0000
Subject: note 33374 deleted from language.oop by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72447@lists.php.net to get a copy of this message
Note Submitter: oran@anonimous.biu.ac.il ---- The editor's suggestion for using the predefined constant __CLASS__ for interaction between static functions is incorrect. __CLASS__ gives the name of the class where the method that uses it is defined, and NOT the name of the extending class that is actually in use. Therefore, the following code on PHP 4.3.0 prints "baseclass, bla" and not "subclass, foo": class baseclass { function static1() {return "bla";} function static2() { return __CLASS__ . ', ' . call_user_func(array(__CLASS__,'static1')); } } class subclass extends baseclass { function static1() {return "foo";} } print subclass::static2();

« previous php.notes (#72447) next »