Think on any finite set of elements that cannot be represented with integers because they don't hold enough data... or because the repeated values.
An extremely example could be the "Periodic Table", finite set of elements, where each element holds a lot of information. function print_element(Element $e) { echo $e->weight(), PHP_EOL, $e->density(), PHP_EOL, $e->protons(), PHP_EOL, $e->neutrons(); } print_element(Element:Hydrogen); print_element(Element:Argon); print_element(Element:Iron); How do you implement this with just string=>integer define or constants? so you need classes.. do they fit well? I don't think so $h = new Hydrogen(); // What would mean this? $h = Element::Hydrogen(); // probably with a static method $h = Element::Hydrogen; // class constant? lack of objects support Martin Scotta On Wed, Feb 23, 2011 at 10:49 AM, Alexey Zakhlestin <indey...@gmail.com>wrote: > On Wed, Feb 23, 2011 at 4:35 PM, Martin Scotta <martinsco...@gmail.com> > wrote: > > Martin Scotta > > > > > > On Wed, Feb 23, 2011 at 7:12 AM, Ben Schmidt > > <mail_ben_schm...@yahoo.com.au>wrote: > > > >> Are you suggesting this as an enum member function, or just a regular > >>>> function in any old class? > >>>> > >>> > >>> "Enum member funcion"? How much it should be like a class before you > >>> call it a class? > >>> > >> > >> Exactly. It's crazy. If you want a 'member function' use a class, not an > >> enum. > >> > > > > why not supporting methods for enum values? > > developers will need that, and by providing type hinting, they will just > > create the logic somewhere else... > > why would developers need this? can you elaborate with some real-life > scenario? > I thought enums are just strong-typed constants > > > -- > Alexey Zakhlestin, http://twitter.com/jimi_dini > http://www.milkfarmsoft.com/ >