|
Posted by Dana Cartwright on 11/05/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]
|