📰 PHP 7.4: most important RFCs

📅 May 1st, 2019 ⏲️ 1 min 1 sec

The release date will be probably in December, 2019. But here is some new features that’ll be available in this version and here is the most important RFC (Request for comments)

Typed Properties in Class

In this version we can type variables in a Class.

* Typed class properties
class AppComponent{
    public string $name;
    public User $user;


It’s a major performance improvements. if you’re using a framework today, its files have to be loaded and recompiled on every request. Preloading allows the server to load PHP files in memory on startup, and have them permanently available to all subsequent requests.

Null coalescing assignment operator

* Null coalescing assignment operator
* This mean if $date is not defined it'll get a new instance of DateTime
$date ??= new DateTime();

Short closures

For those who are familiar with ES6+, Typescript and React JS, the arrow function is now available in PHP. The arrow function let us execute anonymous functions in a map loop.

* Short closures
$cart= [/**/] // An Array of products in a cart.
$prices = array_map(fn($product) => $product->price, $cart);

// comparing to this:
$prices = array_map(function ($product) {
    return $product->price;
}, $cart);

Here is all the RFC of PHP 7.4 https://wiki.php.net/rfc#php_74