Most essential features in PHP 8
Article
Most essential features in PHP 8
This is the excerpt for the latest postPHP 8 is here! It was released on November 26, 2020. You can download it here . It's a new major version, which means that it will introduce some breaking changes, as well as lots of new features...
WHAT'S NEW & MOST ESSENTIAL FEATURES IN PHP 8
PHP 8 is here! It was released on November 26, 2020. You can download it here . It's a new major version, which means that it will introduce some breaking changes, as well as lots of new features and performance improvements. Because of the breaking changes, there's a higher chance you'll need to make some changes in your code to get it running on PHP 8. If you've kept up to date with the latest releases though, the upgrade shouldn't be too hard, since most breaking changes were deprecated before in the 7.* versions. And don't worry, all these deprecations are listed in this post. Besides breaking changes, PHP 8 also brings a nice set of new features such as the JIT compiler, union types, attributes, and more.
NEW FEATURES
- Union Types
- JIT
- The nullsafe operator
- Named Arguments
- Attributes
- Match Expressions
- 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 Stringable 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
- Just In Time Compilation


