Re: Constants

From: Date: Tue, 23 Mar 2004 14:42:04 +0000
Subject: Re: Constants
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181263@lists.php.net to get a copy of this message
If you define constants with in a interface and then implement that interface it does not work on 5RC1 This should work, but it displays the constant name rather than value it references interface Settings { const UNAME = "somename"; const PWORD = "password"; const SERVER = "localhost"; } class Conn implements Settings { public function __construct(){ $dbConn = mysql_connect(SERVER, UNAME, PWORD); } } "Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message news:C8F323573C030A448F3E5A2B6FE2070B03522327@nemesis... [snip] Not too fast..... From http://www.php.net/zend-engine-2.php PHP 5 introduces per-class constants: <?php class Foo { const constant = "constant"; } echo "Foo::constant = " . Foo::constant . "\n"; ?> [/snip] My bad. Still not a bug.

« previous php.general (#181263) next »