In just two days we will get a new PHP release, PHP 8. It’s been almost 5 years since PHP 7 was born and now we are about to enjoy the new major version, which will include some breaking changes and performance improvements.
It comes with a lot of new features, including:
-
PHP JIT
-
Union types
-
Named arguments
-
Attributes
-
Match expression
-
Constructor property promotion
-
New
static
return type -
New
mixed
type -
Throw expression
-
Inheritance with private methods
-
Weak maps
-
Allowing ::class on objects
-
Non-capturing catches
-
Trailing comma in parameter lists
-
Create
DateTime
objects from interface -
New str_contains() function
-
New str_starts_with() and str_ends_with() functions
-
New fdiv() function
-
New get_debug_type() function
-
New get_resource_id() function
-
Abstract methods in traits improvements
-
Object implementation of token_get_all()
-
Variable syntax tweaks
-
Type annotations for internal functions externals
-
ext-json always available
We will explain some of these features in future posts.
Remember that PHP 7.4 active support will remain until November 2021, with security fixes until November 2022. PHP 7.3 active support is almost over and the team will provide security fixes for 1 more year. Finally, PHP 7.2 is already out of active support, and almost out of security fixes (in 5 days). If you want to check PHP versions and support you can go HERE.
So, Are you ready for PHP 8?