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

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]


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

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