PHP 7.4 with FireStorm – new features, distortions and further information
Nowadays a large part of all internet components is based on PHP. Therefore PHP is an exciting and interesting topic. Especially when once again a new update has come on the market, as is the case at the end of 2019. FireStorm offers you as a webhoster the basis for your own website. For this purpose we of course use PHP and have updated to PHP 7.4 for our customers.
In this article we will not only explain what PHP 7.4 is and which innovations, but also rejections there are, but we also establish a connection to classic WordPress websites. – We wish you now much fun with reading!
PHP is the basis for dynamic websites and web applications. With the new update PHP 7.4 the scripting language gets more possibilities.
What exactly is PHP?
PHP is a scripting language that is used worldwide. PHP stands for “Hypertext Preprocessor”, or in its original form for “Personal Home Page Tools”. As the latter name already reveals, the scripting language is used for the creation of dynamic websites. Even the most diverse web applications are now based on PHP.
What innovations does PHP 7.4 bring with it?
At the end of November 2019 PHP 7.4 was released as a new version of PHP 7. The main focus of this long-awaited update is on the speed, reliability and code readability of the scripting language. Since we at FireStorm are absolutely convinced of the innovations and possibilities, we have of course updated to PHP 7.4 as soon as possible for our customers. Which new functions this brings you can read on the official RFC page or simply comfortable in our overview:
The Spread Operator in Array Expression
With the new update, array_merge is a thing of the past, since the spread operator returns in array expression. This takes care of the easy and fast unpacking of unpacking of arrays and traversables in argument lists.
The Arrow Functions 2.0
Thanks to the Arrow Function 2.0, which is also called Short Closures, PHP code can be cleaned up easily. This makes anonymous functions easier to implement and faster to maintain.
The Null Coalescing Assignment Operator
Using the Null Coalescing Assignment operator, the first operand is returned instead of zero if it exists. If not, the second operand is returned. This procedure is useful when using a ternary operator in conjunction with isset().
The Typified Properties 2.0
The type of a variable can be specified by means of type references or argument type declarations. This type is likely to be passed to a method of a class or a function. This update adds type hinting support for first-class property type declarations to the PHP scripting language.
The Weak References
With the class class WeakReference, references to objects can be retained, preventing the self-destruction of objects. Now a new API makes a distinction between the documented WeakRef class.
Thanks to many new features PHP 7.4 offers more speed and reliability and better code readability.
The covariant returns & contravariant parameters
With the covariant return, the order of the types is retained and the types are ordered; from specific to generic. With contra-variant parameters, however, the sequence is reversed and the types are ordered from generic to specific. The update is intended to allow covariance and contravariance for parameter types and return types.
The preloading
Thanks to the preload, PHP 7.4 brings significantly more performance. This is because the process causes frameworks and libraries to be loaded into the OPCache during module initialization.
The new serialization mechanism
With the new PHP 7.4 update comes a completely new mechanism for serializing user-defined objects. This gives programmers more possibilities and less problems, through the two new magic methods: __serialize() & __unserialize().
What was discarded in PHP 7.4?
As with every new update, PHP 7.4 has not only many new features, but also some discards. We will now briefly list these two most important issues in the following:
Changing the priority of the link operator
The arithmetic operators “+” and “-” and the string operator “.” have the same priority. They are left associative.
The rejection of the left-associative ternary operator
Due to some confusion from other programming languages, the left-associative ternary operator has now been discarded. Before, the ternary operator in PHP was left-associative.
What does the PHP 7.4 update mean for WordPress website?
Since all WordPress websites run via PHP and PHP is the foundation for a successful internet presence, WordPress website operators should pay attention now. Unfortunately, countless WordPress websites still run on outdated PHP versions, as the WordPress statistics linked here show.
Since PHP is crucial for the performance, speed and reliability of the website, WordPress website operators should act promptly. At FireStorm we always offer our customers the latest PHP version to make an optimal internet presence possible.