What’s new in PHP 7.4

PHP 7.4 was released on November 28, 2019 and it’s the last version before PHP 8.

New features

PHP 7.4 comes with a remarkable amount of new features.

The following a list of all new features.

Arrow functions

Arrow functions, also called “short closures”, allow for less verbose one-liner functions.

There are a few notes about arrow functions:

  • They can always access the parent scope, there’s no need for the use keyword.
  • $this is available just like normal closures.
  • Arrow functions may only contain one expression, which is also the return statement.

Typed properties

Class variables can be type hinted: