Whats new in PHP 7.4

PHP core team possibly release PHP 7.4 somewhere on December 2019. Today we take a look at some new upcoming features and improvements.

Preloading:

This feature can resolve performance related issues in PHP. In Short if you are using the framework then it’s file loaded and recompiled on each and every request. Preloading allow us to store files in memory on startup and then available for each and every request. If files are changed then server will be restart.

FFI:

FFI means Foreign Function Interface, it is allow us to call C code from userland. This means that PHP extensions can be written in pure PHP. This is complex topic and you need C code knowledge to use this feature.

For more information refer the https://react-etc.net/entry/php-ffi-allows-embedding-raw-c-code-in-php-scripts-php-7-3

Null Coalescing Assignment Operator:

// Now
$dateTime = $dateTime ?? new DateTime();

// in PHP 7.4
$dateTime ??= new DateTime();

ext-hash always enable:

This extension is permanently available for all PHP installations.

Password Hashing Registry:

Internal changes to how hashing libraries are used, so that it’s easier for userland to use them.

Type Property:

Class variable can be type hinted.

class Test
{
    public string $demo;
    
    public Bar $bar;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top