Major update to the popular scripting language also features performance and syntax improvements and new stand-alone types. 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 readonly modifier will mark all instance properties of the class as read-only and prevent the creation of dynamic properties. Marking readonly classes with the AllowDynamicProperties attribute triggers a compile error. The addition of null, false, and true as 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 false and true are 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: Disjunctive normal form (DNF) types enable the combination of union and intersection types, following a strict rule that says when combining union and intersection types, intersection types must be grouped with brackets. A “random” extension provides an object-oriented API to random number generation. The creation of dynamic properties has been deprecated, to help avoid mistakes and typos, unless the class opts in by using the AllowDynamicProperties attribute; stdclass allows dynamic properties. New classes, interfaces, and functions are featured, such as a msqli_execute_query function and a SensitiveParameter attribute. Constants now can be defined in traits. The ${} string interpolation has been deprecated. 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. Related content analysis Beyond the usual suspects: 5 fresh data science tools to try today The mid-month report includes quick tips for easier Python installation, a new VS Code-like IDE just for Python and R users, and five newer data science tools you won't want to miss. By Serdar Yegulalp Jul 12, 2024 2 mins Python Programming Languages Software Development analysis Generative AI won’t fix cloud migration You’ve probably heard how generative AI will solve all cloud migration problems. It’s not that simple. Generative AI could actually make it harder and more costly. By David Linthicum Jul 12, 2024 5 mins Generative AI Artificial Intelligence Cloud Computing news HR professionals trust AI recommendations HireVue survey finds 73% of HR professionals trust AI to make candidate recommendations, while 75% of workers are opposed to AI making hiring decisions. By Paul Krill Jul 11, 2024 3 mins Technology Industry Careers how-to Safety off: Programming in Rust with `unsafe` What does it mean to write unsafe code in Rust, and what can you do (and not do) with the 'unsafe' keyword? The facts may surprise you. By Serdar Yegulalp Jul 11, 2024 8 mins Rust Programming Languages Software Development Resources Videos