I know that PHP doesn\'t have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values whi
abstract class Enumeration { public static function enum() { $reflect = new ReflectionClass( get_called_class() ); return $reflect->getConstants(); } } class Test extends Enumeration { const A = 'a'; const B = 'b'; } foreach (Test::enum() as $key => $value) { echo "$key -> $value"; }