image credit: Unsplash

PHP 8.1 brings enums, read-only properties

November 30, 2021

Via: InfoWorld

PHP 8.1, billed as a major update to the popular scripting language for web development, has been released with capabilities ranging from enums and read-only properties to first-class callable syntax.

PHP 8.1 was released on November 25. Source code and Windows binaries can be downloaded from

Enums, or enumerations, allow developers to define a custom type that is limited to a discrete number of possible values. This can be helpful when defining a domain model by “making invalid states unrepresentable,” according to PHP documentation. In PHP, enum cases are valid objects that can be used anywhere an object may be used, including type checks.

Read More on InfoWorld