PHP7.4 news
PHP 7.4the last minor release of PHP 7, was released on November 28, 2019: the goal is to enhance performance and improve code readability.
Following the release, we have already made it available PHP 7.4 on all of ours Web Hosting multiPHP (plans Standards, business and enterprise), LAMP and Plesk servers (new activations only): it is essential for a hosting provider to provide an updated version of PHP in order to guarantee greater security and increase the speed of websites that hosts.
Let’s now focus on the news and the most significant factors that characterize the latest version.
Content index:
What is PHP?
PHP is a server-side programming language designed for developing dynamic websites.
Increasingly central to the world of web programming, PHP can be embedded in HTML and interacts with other languages: for example, WordPress itself is developed in PHP with MySQL database. It is an open source language and relatively easy to use: for this reason, we are seeing continuous improvements of the same and of the features with the latest releases. By updating PHP to the latest version 7.4, you will notice improvements in both performance and security of your website or web application.
QWhat’s new?
Since 2016, PHP 7 has been releasing annual updates to make the code cleaner and more user-friendly, while increasing its performance and security.
Let’s see together main innovations introduced.
Arrow Functions
Anonymous functions in PHP (also known as short closures) are very useful because they allow you to create functions without specific names; they can, however, be verbose. With the PHP 7.4 update, les are introduced Arrow Functionswhich allow you to shorten anonymous functions, creating shorter codes with a single line of writing.
From the site WikiPHPfirst:
Now:
Typed properties
The typing of the properties is a real modification of the language and the novelty introduced by the PHP 7.4 version concerns the type declarations also for the properties of a class.
Always quoting WikiPHPfirst:
Thanks to version 7.4, it will no longer be necessary to use methods setters/getters that force the typing of properties:
Null Coalesce
The operator null coalesces is a comparison operator that has the purpose of assigning default values to variables. With the new 7.4 version, it will be possible shorten the operator’s writingtransforming the null coalesces from a comparison operator to an assignment operator.
If the left parameter is null, the operator assigns the value of the right parameter. If the value is not null, no action is taken.
Following the directions of WikiPHP:
Basically, thanks to the new release, the code you can write will be the one in the last line.
Preloading
The preloading, or pre-loading, is a modification that concerns the improvement of performance, on the user’s side (UX optimization). Thanks to pre-loading the server will load PHP scripts into memory at startup and will always make them available for any subsequent request.
These are some of the main features introduced but you can check the complete list in the official siteto keep you updated on all the new features introduced and deprecated features.
Why is it important to update PHP?
As mentioned earlier, PHP is the programming language on which WordPress is built: a third of the web uses WordPress as a CMS for the development and management of its website. WordPress usage went from about 13% in 2011 to more than 33% in 2019, according to data collected by the site. WordPress.
With the introduction of version 7.4, the data of deprecated PHP users increases: version 7.0 is used by 16.2% of users while version 5.6 still has a high percentage of use, around 29%, as reported by the site Of WordPress.
Keeping the PHP version updated brings 2 main advantages:
- More speed for your site: the latest PHP version, in fact, being updated with new functions will make your site faster than previous versions: this could translate into better positioning in SEO terms and a better user experience on your site.
- Increased security for your site: PHP is a very popular programming language and a target for many hackers to break into your site. Precisely for this reason, updating the PHP version also means updating the security factors, implementing new solutions and making it difficult for hackers to penetrate your site.
Based on these considerations, in addition to updating PHP, it is also essential to update WordPress so as to be able to get the maximum benefit in terms of performance and security. In fact, having an updated version of PHP, but outdated WordPress, or an updated version of WordPress, but outdated PHP, could cause errors on your website, hindering your daily operations: if WordPress itself encourages the PHP update used for your site, why not follow the advice?
We always recommend versions to update both PHP and your WordPress site, that’s why we have included the new version in our services, with the aim of guaranteeing you adequate security for your website: we think that the latest minor release, PHP 7.4, moves decisively in this direction, both on the user side and on the programmer side.
The computer world is always up to date, and the most enthusiasts are already counting down to the release of the next version, PHP 8, which has already approved JIT (Just in Time) support: a technique that will compile parts of the code at runtime, to ensure greater speed.