note 71736 added to language.oop5.constants

From: Date: Wed, 13 Dec 2006 18:46:08 +0000
Subject: note 71736 added to language.oop5.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-120586@lists.php.net to get a copy of this message
I was having problems accessing my constants from an extended class in my abstract class, i.e.: abstract class a { public function showConst() { echo self::foo; } } class b extends a { const foo = 'something'; } I found a way to work around this is to switch self::foo with eval("return " . get_class($this) . "::foo;") hope this helps someone. ---- Server IP: 82.165.230.124 Probable Submitter: 64.128.188.63 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php Edit -- https://master.php.net/note/edit/71736 Del: integrated -- https://master.php.net/note/delete/71736/integrated Del: useless -- https://master.php.net/note/delete/71736/useless Del: bad code -- https://master.php.net/note/delete/71736/bad+code Del: spam -- https://master.php.net/note/delete/71736/spam Del: non-english -- https://master.php.net/note/delete/71736/non-english Del: in docs -- https://master.php.net/note/delete/71736/in+docs Del: other reasons-- https://master.php.net/note/delete/71736 Reject -- https://master.php.net/note/reject/71736 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120586) next »