Coding for the web
Enumerations in PHP 8.1
Enumerations is something that has long been lacking in PHP in my opinion. Developers would use constants and defines to simulate similar functionality to enumerations, but that in itself came with it’s own set of challenges.
Apparently now, PHP 8.1 has introduced enumerations as a native value type. Be aware that this will not work in earlier versions of PHP, so before updating code that uses it, make sure your production…