RE: [PHP] Constants

From: Date: Tue, 23 Mar 2004 13:32:07 +0000
Subject: RE: [PHP] Constants
Groups: php.general 
Request: Send a blank email to php-general+get-181250@lists.php.net to get a copy of this message
[snip] <?php interface Foo { const MY_FOO = "hello world"; } class Bar implements Foo { public function displayFoo(){ print MY_FOO; } } $obj = new Bar; $obj->displayFoo(); ?> The results should display "hello world", but it prints out MY_FOO. [/snip] This is not a bug, but a misunderstanding of constants. You have not defined the constant.... define("MY_FOO", "hello world."); http://us4.php.net/constants

« previous php.general (#181250) next »