Menu
WordPress Web Design - Marketing - Hosting

Major PHP 8.0 Update

November 11, 2020
PHP 8.0 is available at dev2host

Everything You Need to Know About the Major PHP 8.0 Update (2020)

(NOTE- This post was created in 2020 and PHP 8.0 is now depreciated)

dev2host supports PHP 8.0. We are still provisioning our web hosting packackes with PHP 7.4. If you would like to use PHP 8.0, login to your cPanel and navigate to “PHP Selector”. You can change your PHP version and modules.

On November 26th 2020, the PHP development team announced their newest release of PHP 8.0;

“PHP 8.0 is a major update of the PHP language. It contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, null safe operator, JIT, and improvements in the type system, error handling, and consistency.”

With over 25 new features, breaking changes and performance improvements, PHP 8.0 will allow for “better performance, better syntax, and improved type safety.” (PHP.net)

The PHP 8.0 update includes the following new features:

  • Named Arguments RFC
  • Attributes RFC Doc
  • Constructor Property Promotion RFC Doc
  • Union Types RFC Doc
  • Match Expression RFC Doc
  • Nullsafe Operator RFC
  • Saner String to Number Comparisons RFC
  • Consistent Type Errors for Internal Functions RFC
  • Just-In-Time Compilation: Tracing JIT and Function JIT are the two compilation engines that have been introduced with the new update. Tracing JIT: performs about 3x better on synthetic benchmarks and a 1.5–2x improvement on specific long-running applications.

In addition to these new features, the PHP 8 Update includes type system and error handling improvements including:

  • Stricter type checks for arithmetic/bitwise operators RFC
  • Abstract trait method validation RFC
  • Correct signatures of magic methods RFC
  • Reclassified engine warnings RFC
  • Fatal error for incompatible method signatures RFC
  • The @ operator no longer silences fatal errors
  • Inheritance with private methods RFC
  • Mixed type RFC
  • Static return type RFC
  • Types for internal functions Email thread
  • Opaque objects instead of resources for CurlGdSocketsOpenSSLXMLWriter, and XML extensions

Other syntax adjustments and improvements on the update include:

  • Allow a trailing comma in parameter lists RFC and closure use lists RFC
  • Non-capturing catches RFC
  • Variable Syntax Tweaks RFC
  • Treat namespaced names as single token RFC
  • Throw is now an expression RFC
  • Allow ::class on objects RFC

The last part of the update provides new classes, interfaces, and functions including:

With the extensive new features, updates, and breaking changes, it’s likely changes will need to be made in your code to ensure it’s running properly with the new version. For more information on PHP 8.0, visit the official announcement on the PHP website

Source: https://www.php.net/releases/8.0/en.php