PHP 8.1 Released With Fibers, Enumerations, Read-Only Properties & Much More
Written by Michael Larabel in Programming on 25 November 2021 at 02:16 PM EST. 6 Comments
PROGRAMMING --
PHP 8.1.0 was just officially released as the latest annual feature update to this widely-used, server-side programming language.

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.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week