05 - PHP 8.2

Home

05 PHP 8.2 Home

New version of PHP got major updates on performance, syntax, type safety imporovements as well as new capabilities such as read only classes and stand alone types.

PHP New Version - Read only classes

One of the new features appeared in PHP 8.2 is read ony classes. Support for read only classes means a class marked with the 'readonly' will have all instance properties of class as read only without dynamic properties.

PHP New Version - Allow 'true', 'false' and 'null' as Standalone Types

PHP 8.0 allowed 'false' and 'null' as part of union types. Latest version allowed 'false' and 'null' as standalone types. Also, PHP 8.2 adds support for the 'true' type as well. Howerver, both 'true' and 'false' cannot be declared together in a union type. This new feature made PHP's type system more expressive and complete.

PHP New Version - New 'mysqli_execute_query' function and 'mysqli:execute_query' method

New PHP 'mysqli_execute_query' function and 'mysqli:execute_query' method allow running parameterized MySQLi queries easier. 'mysqli_execute_query' function is a combination of 'mysqli_prepare()', 'mysqli_execute()' and 'mysqli_stmt_get_result()'. The new function lets MySQLi query to be prepared, bound (if there are parameters) and executed within the function itself. If the query runs successefully it will return 'mysqli_result' object, if not it will return 'false'.

Summary of the documentation

Latest version of PHP brings massive improvements in PHP. The most exciting features are new standalone types, readonly properties and lots of performance improvements. Among other latest features there are DNF types enable combination of union and intersection types, a 'random' extension, the creation of dynamic properties has been canceled, new classes, functions and interfaces and many others.