The PHP team announced the official release of PHP 8 on November 26, 2020!
Download address: https://www.php.net/downloads.php
PHP 8.0.0
Currently the latest major version, it introduces some breaking changes, as well as many new features and performance optimizations:
Notable improvements in PHP 8.0 include
1. PHP 8.0 introduces the highly anticipated Just In Time (JIT)
compiler, which can further improve the execution speed of PHP scripts
2. PHP 8.0 incorporates many performance optimizations
3. JSON support is now considered a core part of the language and is always available, rather than as an optional module.
4. Supports named
parameters as they enable specifying parameter names. Instead of their exact order
5. Attributes (or also called annotations or modifiers in other languages) that support structured metadata for classes/properties/functions/methods/parameters/constants
6. Supports union types that can indicate multiple different types. These types can be used as parameters or return types of functions.
7. Support static return types.
8. str_contains The ()
function is a convenient way to check if a string is contained within another string without having to use strpos etc. Similar to this are the new str_starts_with()
and str_ends_with()
functions
9. The Nullsafe
operator is added as a method A quick and easy way to apply empty merge behavior on
10. Compared with the stable version of PHP 7.4, PHP 8.0 has improved performance by about 10%, but at least in some aspects, JIT can provide more performance
New features of PHP8 Related articles:
《The new features of PHP 8: The impact of JIT on PHP application performance》
《The constructor attribute of the new feature of PHP 8 has been greatly enhanced! 》
JIT’s contribution to PHP 8 performance:
For more PHP8 related features and technical articles, please visit the PHP8 special column!