PHP in 2020

PHP 8.0.0 Beta 3 is available for testing

Currently PHP 8.0.0 is available for testing, Since it’s a major version release, you can expect few backward breaking changes.

Along with breaking changes it also introduced many new features and fixes.

For a complete list of fixes and features check this link.

Major backward incompatible changes which may impact you

  1. match is now a reserved keyword. It means now you can’t create methods, classes, traits etc with this name.
  2. Methods with the same name as the class are no longer interpreted as constructors. The __construct() method should be used instead.
  3. Removed ability to specify an autoloader using an __autoload() function. spl_autoload_register() should be used instead.
  4. The @ operator will no longer silence fatal errors.

New features

Union types

After the introduction of type hinting in PHP 7.0, community has introduced Union types which may bring more control over argument data types.

JIT

This feature will promise significant performance improvements.

nullsafe operator

As null coalescing operator introduced in PHP 7.0, similarly nullsafe operator has been introduced which will work on method call.

Tokenizer

The new PhpToken class adds an object-based interface to the tokenizer. It provides a more uniform and ergonomic representation, while being more memory efficient and faster.

Deprecated Functionality

  1. Declaring a required parameter after an optional one is deprecated.
  2. ReflectionFunction::isDisabled() is deprecated.
  3. libxml_disable_entity_loader() has been deprecated.

Other changes

  1. The JSON extension cannot be disabled anymore and is always an integral part of any PHP build, similar to the date extension
  2. The minimum required libxml version is now 2.9.0.