Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is an enum in PHP 8.1 used for?

  1. A Defining a fixed set of named, type-safe values
  2. B Enumerating array keys
  3. C Iterating over collections
  4. 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.

All Php MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as