|
Posted by Ryan Lange on 11/06/06 11:31
========================================================================
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++ );
>
> I suspect most C programmers, seeing the above, would say "Aha, it's an
> enumeration", which is really what one is after, I think.
Keeping with cat=1, dog=2, and fish=3, shouldn't that be either:
$n = 1;
....or...
$n = 0;
define('ALL_CAT', ++$n);
....etc?
- Ryan
Navigation:
[Reply to this message]
|