|
Posted by Dana Cartwright on 11/08/29 11:31
"Ewoud Dronkert" <firstname@lastname.net.invalid> wrote in message
news:iu7um1151i46lhunv0070528r8bdgat13a@4ax.com...
> Oli Filth wrote:
>> Seamus M said the following on 06/11/2005 22:40:
>>> I can't find any info on enumerations in the PHP manual
> Or constants, but they are not restricted to one type or container:
>
> define('ALL_CAT', 1);
> define('ALL_DOG', 2);
> define('ALL_FISH', 3);
> echo ALL_CAT;
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.
[Back to original message]
|