PHP 8.1 Released With Fibers, Enumerations, Read-Only Properties & Much More
PHP 8.1 finally introduces the notion of "enums" or enumerations for a custom type that is a discrete number of possible values. PHP enums can be used anywhere an object can be used.
Another one of the big ticket items added in PHP 8.1 is Fibers. With PHP Fibers, there is support for full-stack, interruptible functions that can be used for handling cooperative multi-tasking within PHP. More details on PHP Fibers via this page.
PHP 8.1 also introduces support for read-only properties for preventing such properties from being changed after initialization. PHP 8.1 also brings intersection types, the "never" return type for functions that never return but should either exit / throw an exception / not terminate, the final modifier for class constants, new fsync functions, array_is_list(), and explicit octal numeral notation.
More details and downloads for today's PHP 8.1.0 release via PHP.net.