Reply to Re: [PHP] PHP5 class constants

Your name:

Reply:


Posted by Chris on 10/20/87 11:30

Dragan Stanojevic - Nevidljivi wrote:

> Jasper Bryant-Greene wrote:
>
>> 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:
>>
>>
>>
> Oh, thanks Jasper...
>
> Pitty though, code would be a lot cleaner if the constant setting
> would allow it (put evaluated value in constant).
>
> bye,
> N::
>
That constant is the same throughout all instances of the object, So you
can't calculate the value based on instantiated info.

Though I suppose you could make an argument for using expressions that
consist of only constant values.

Chris

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация