0

On the use of Enums

 1 year ago
source link: https://www.garfieldtech.com/blog/on-the-use-of-enums
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

On the use of Enums

Submitted by Larry on 27 June 2022 - 10:38am

Enumerations are a feature of many programming languages. However, we should perhaps say "many languages have a feature called enumerations." What that means in practice has a lot of language-specific semantic nuance, and trying to use the feature of one language as though it were the feature of another language can lead to all kinds of broken code. (That's true of most language features.)

So how are Enumerations best used in PHP, specifically? Let's have a look at some examples, and see where they should, and shouldn't, be used.

Continue reading this post on PeakD.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK