I have lists where strings correspond with values. For example, in a company list I could have Microsoft correspond with the letters MS.
Obviously, this could be transposed as a table in MySQL to make the list extensible but, from curiosity, how would you express this in constant form in PHP ?
P.S: There is the class-with-constants approach (see accepted answer here: PHP and Enumerations) to act as an enumeration but would that really be of any use seeing that enumerations map to integer values ?
How about using define
This would echo Microsoft.
http://php.net/manual/en/function.define.php
Also the link you gave to a possible solution could just as easily be used with strings instead. The only reason it acts as an enum from other languages is because you define the values from 0 to n, instead of doing that just use string instead.
I think this would work.