New in PHP 7.4

PHP 7.4 will probably be released somewhere December 2019. This page will receive regular updates meanwhile. Last update was January 14, 2019

Preloading rfc

Preloading is an amazing addition to PHP's core, which can result in some major performance improvements.

In short: 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.

The performance gain comes of course with a cost: if the source of preloaded files are changed, the server has to be restarted.

Typed properties rfc

Class variables can be type hinted:

class A
{
    public string $name;
    
    public Foo $foo;
}

Update 07-01: As of now, typed properties are merged, and thus confirmed for PHP 7.4.

Improved type variance rfc

I wrote about PHP's type system in the past, so it's good to see some improvements are actually arriving in PHP's core.

Type variance is a topic worth its own blog post; in short: you'll be able use covariant return types…

class ParentType {}
class ChildType extends ParentType {}

class A
{
    public function covariantReturnTypes(): ParentType
    { /* … */ }
}

class B extends A
{
    public function covariantReturnTypes(): ChildType
    { /* … */ }
}

… and contravariant arguments.

class A
{
    public function contraVariantArguments(ChildType $type)
    { /* … */ }
}

class B extends A
{
    public function contraVariantArguments(ParentType $type)
    { /* … */ }
}

Update 14-01: The RFC is currently in the voting phase, but it looks like it'll pass without any problems.

This is where the ad would go. I get it, they are stupid. But to be honest, they actually make a difference. So maybe you'd consider whitelisting this blog?

Foreign Function Interface rfc

Foreign Function Interface, FFI in short, allows calling C code from userland. This means that PHP extensions can be written in pure PHP.

It should be noted that this is a complex topic. You still need C knowledge to be able to correctly use this feature.

Null Coalescing Assignment Operator rfc

Instead of doing this:

$data['date'] = $data['date'] ?? new DateTime();

You can do this:

$data['date'] ??= new DateTime();

Update 22-01: this feature is now merged in PHP 7.4.

ext-hash always enabled rfc

As the title says, this extension is now permanently available in all PHP installations.

Password Hashing Registry rfc

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

Hang on now…

If you've made it this far, chances are you are interested in PHP. Maybe you're also interested in reading my other content? Here are some of the things I wrote.

Oh and lastly, follow me on Twitter if you want to stay up to date!