New Features in PHP 8.2
PHP has over 1,000 built-in functions that can be used to perform a wide variety of tasks. In addition, you can also write your own custom functions to perform specific tasks in your program.
PHP supports detailed stack tracing, which makes it easy to debug code and troubleshoot performance bottlenecks. But this can be a privacy risk, as the full stack trace is visible to third-party services that may need it for analysis and diagnostics (such as Kinsta APM). To help address this issue, PHP 8.2 introduces support for marking parameters as sensitive so they won’t appear in the detailed stack trace.
In the same release, PHP is also adding a new type for functions that will make it easier to create and use custom types in your code. This will allow you to declare more precise return, parameter, and property types.
Another feature introduced in this version of PHP is a way to declare a readonly property on a class. This is an important part of functional programming, and it’s good to see that PHP is starting to catch up with modern languages like Ruby that already support it.
Finally, PHP is expanding its support for the false type. This seems to be a natural counterpart to the true type, and it’s nice that PHP is starting to include it as a standalone type in the language.