Reply to Re: PHP Enumerations?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на 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

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