PHP 8.1 Released: What's New?
An updated version of the PHP language has been released. The release number 8.1 took place on November 25, a year after the start of development. The update brought a lot of innovations expected by fans of the language.
Among the changes in PHP 8.1 it is worth highlighting:
- The ability to enumerate objects, which allows you to replace the declaration of constants inside a class with an enumeration of variables in the body of the enum function.
- Readonly properties that cannot be changed after program initialization.
- Ability to use objects as default parameters.
- Syntax for checking multiple data types in a function argument list.
- The never property tells the program that the function never returns.
- Support for fibers, that is, blocks of code that can be started and paused at any time.
- ARM64-based Just-In-Time support.
Also, the developers have done serious work to optimize the code and made the language more efficient, increasing the processing speed by 23% in the Symfony Demo test and by 3.5% speeding up the launch of WordPress-based sites.
You can read about other innovations in PHP 8.1 on the official developer blog.