What is an enum in PHP 8.1 used for?
- A Defining a fixed set of named, type-safe values
- B Enumerating array keys
- C Iterating over collections
- D Declaring constants in an interface
Answer
Defining a fixed set of named, type-safe values
Enums replace loose class constants with a real type, so an invalid value cannot be passed where the enum is expected.





