Most essential features in PHP 8

Article
Background
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

  1. Union Types
  2. JIT
  3. The nullsafe operator
  4. Named Arguments
  5. Attributes
  6. Match Expressions
  7. Constructor Property Promotion
  8. New static return type
  9. New mixed type
  10. Throw expression
  11. Inheritance with private methods
  12. Weak Maps
  13. Allowing ::class on objects
  14. Non-capturing catches
  15. Trailing comma in parameter lists
  16. Create DateTime objects from interface
  17. New Stringable interface
  18. New str_contains() function
  19. New str_starts_with() and str_ends_with() functions
  20. New fdiv() function
  21. New get_debug_type() function
  22. New get_resource_id() function
  23. Abstract methods in traits improvements
  24. Object implementation of token_get_all()
  25. Variable syntax tweaks
  26. Type annotations for internal functions externals
  27. ext-json always available
  28. Just In Time Compilation
Service image