You are here: Re: PHP Enumerations? « PHP Programming Language « IT news, forums, messages
Re: PHP Enumerations?

Posted by Dana Cartwright on 11/06/69 11:31

"Ryan Lange" <cl1mh4224rd@gmail.com> wrote in message
news:IeCdnRQmNqjgtezeRVn-pA@comcast.com...
> ========================================================================
> Dana Cartwright wrote:
>> You can get closer to the 'auto-increment' characteristic of true ENUM's
>> by:
>>
>> $n = 0;
>> define( 'ALL_CAT', $n++ );
>> define( 'ALL_DOG', $n++ );
>> define( 'ALL_FISH', $n++ );
>>

> Keeping with cat=1, dog=2, and fish=3, shouldn't that be either:
>
> $n = 1;
>
> ...or...
>
> $n = 0;
> define('ALL_CAT', ++$n);
>

C enumerations start at zero, which is why I wrote it that way. The OP
talked about enumerations, and I was staying with that spirit.

 

Navigation:

[Reply to this 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

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