PHP Programming
Group for all things PHP, Coding Help, Problems and Solutions
108 Members
Join this group to post and comment.
10 Jan 2019

New Features in PHP 7.4 - Preloading, Typed Properties, FFI

Let's talk about the new stuff in PHP 7.4, which is going to be the next major release for PHP. It's still faraway from releasing and the release is expected sometime towards the end of this year. I decided to make a small list of new things coming your way in PHP 7.4 -


It's a double-edged sword. What preloading does is that it will load all of your PHP framework (like Laravel, Symphony, CakePHP etc.) in memory when the server boots up. 

Because the entire framework is 'preloaded' in the server memory, all subsequent requests to the the server will be served directly from memory. This approach is going to results into speed and performance benefits. 

Preloading will be controlled by just a single-line directive in your php.ini file - opcache.preload. 

There are no backwards compatibility issues. 

The downside of this approach, however, is that whenever you upgrade your framework, you will need to restart your server. 

Typed Properties

With typed properties, following is now possible. Of course, it's not really clear whether this will be accepted in 7.4.

class MyClass
    public string $variable;

    public Foo $my_variable;

Foreign Function Interface [PHP: rfc:ffi

Perhaps this is inspired from Python. FFI allowed Python to be useful for super rapid prototyping. PHP FFI will allow writing PHP extensions in pure PHP, without needing C libraries. 

I'm quite interested in preloading, but have yet to see the performance benefits it will bring.

4mos ago

I was thinking about this and how'd precaching affect the existing users. First thing - those who're on shared hosting will not be able to enjoy the benefits of the precache. 

There are lot of shared hosting providers who're still on PHP 5.6 because they've to support legacy clients. They're missing out on the speed and performance improvements of the 7.X series. 

Even if they enable PHP 7.4; they won't be able to restart the server for each client. So the benefits will be limited to those who are in private VPS OR dedicated server where you can actually restart your instance and enable precaching. 

The server start time is typically between 1-3 minutes; and many clients are going to oppose that. It still is an interesting improvement that I look forward to.

Jasmine SA
Jasmine SA
4mos ago

Not all RFCs have been accepted yet. There's a wait of a few months before we'll actually know about the new additions to PHP 7.4. Preloading is definitely an interesting addition to the PHP core and I look forward to typed properties in 7.4.

Once these properties are inducted in PHP, it will be lot interesting to find out if frameworks like Laravel and libraries like Symphony adopt the new stuff. 

4mos ago

That's right, @Jasmine SA . All the RFCs haven't been accepted so far. However, I'm happy to see the direction in which PHP is heading. 

Yes, typed properties will make coding more interesting and I hope it will help reduce the generate hate most Java developers have towards it. 

Nonetheless, PHP continues to be one of the most widely used programming languages.  The likely date of PHP 7.4 release is in November or December 2019. Can't wait.