Re: PHP5 class constants

From: Date: Fri, 28 Oct 2005 01:50:07 +0000
Subject: Re: PHP5 class constants
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-224751@lists.php.net to get a copy of this message
On Fri, 2005-10-28 at 01:02 +0200, Dragan Stanojevic - Nevidljivi wrote: [snip] > and it works fine, I cannot define a constant by expression, like: > > class Foo { > const AAA = 1 << 0; > const BBB = 1 << 1; > const CCC = 1 << 2; > const DDD =1 << 3; > } > > Well now, is this a bug, and I should file it, or is it, and why, normal? Not a bug. Read manual. >From http://php.net/oop5.constants comes the following: "The value must be a constant expression, not (for example) a variable, a class member, result of a mathematical operation or a function call." -- Jasper Bryant-Greene General Manager Album Limited e: jasper@album.co.nz w: http://www.album.co.nz/ b: http://jbg.name/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand

« previous php.general (#224751) next »