The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Thursday 14 May 2009

Enumerator class in PHP

If you want an elegant way to an have enumerated type try this:


class QFlashMessageType {
const Info = 0;
const Error = 1;
}


You can use it in this way:
QFlashMessageType::Info;

An enum class example on stackoverflow: http://stackoverflow.com/questions/254514/php-and-enums

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home