PHP·98 questions

What is an enum in PHP?

Answer
PHP 8.1+.
enum Status { case Pending; case Active; }.
Backed enums: enum Status: string { case Pending = 'pending'; }.
Type-safe enumerations.
Methods can be added.
Was this answer helpful?

More questions in this topic

Related questions from other topics