'PHP 8' officially released, many new features such as JIT and union type



A major update ' PHP 8.0.0 ' of

PHP, an open source programming language used on websites, has been released. It implements a number of new features, such as a just-in-time compiler (JIT) that can reduce code execution time and a union type that can handle multiple types.

PHP: PHP 8.0.0 Release Announcement
https://www.php.net/releases/8.0/en.php



◆ JIT
One of the new features in PHP 8 is JIT, which improves program execution speed by compiling frequently executed code. PHP 8 has two types of JITs

, a tracing JIT and a function-based JIT, and the performance with the tracing JIT is about 3 times that of the benchmark without JIT, and the execution time is about 3 times. It is about 1.5 to 2 times longer for long applications.



◆ Named arguments
A named argument has been implemented that allows you to specify which value to pass to which argument when calling a function or method. This allows you to specify only the variables you need and omit the variables you don't need.



◆ Attributes

You can now write metadata and generate documentation in PHP's original syntax instead of PHPDoc .



◆ Constructor description Template simplification
It's now easier to write constructor templates.



◆ Union type
A union type that can handle multiple type combinations has been implemented.



◆ Match statement
A Match statement has been introduced that makes it easier to describe judgment expressions that were written in Switch-Case statements up to PHP 7.



◆ Nullsafe operator
Introduced the Nullsafe operator, which can determine Null for the entire chain by connecting variables with '?'. This eliminates the need to make a null check on individual variables.



◆ Change the behavior of comparison operators
In PHP 8, the behavior of comparison operators has been revised to use numeric comparison when comparing numeric strings. Otherwise, convert the number to a string and use string comparison.



◆ Consistent internal function type error
Most internal functions now return an error exception if the variable validation fails.



This major update has partially broken backwards compatibility and may require minor code fixes. The details of the new features added in PHP 8 are explained in detail in the following articles.

List of new features added in PHP 8 update --GIGAZINE

in Software, Posted by darkhorse_log