No products in the cart.
By Paul Krill
Editor at Large, InfoWorld |
A major update to the stalwart scripting language for web development, PHP 8.2 has arrived with performance, syntax, and type safety improvements along with new capabilities such as read-only classes and stand-alone types.
PHP 8.2 was published December 8 and can be accessed from php.net.
Support for read-only classes in PHP 8.2 means that a class marked with the
readonlymodifier will mark all instance properties of the class as read-only and prevent the creation of dynamic properties. Marking
readonlyclasses with the
AllowDynamicPropertiesattribute triggers a compile error.
The addition of
trueas stand-alone types in PHP 8.2 is described as a “programming enhancement.” The null type corresponds to PHP’s unit type (the type that holds a single value) while
trueare literal types of type
bool. These changes promote type system completeness and serve a number of edge cases.
In other improvements in PHP 8.2:
PHP 8.1, which featured new capabilities regarding enums, syntax, and read-only properties, arrived in November 2021. It was followed by several point releases.
Next read this:
Paul Krill is an editor at large at InfoWorld, whose coverage focuses on application development.
Copyright © 2022 IDG Communications, Inc.
Copyright © 2023 IDG Communications, Inc.