The latest stable version of PHP 7.4 is out as of Novemer 28 and it’s already available to use for the creation of a new hosting instance with Gandi.
Here’s the main list of new features:
PHP 7.0 introduced scalar and return type declarations. Now, with PHP 7.4, it’s possible to type class and object proprerties without having to define getters and setters.
PHP 7.4 also changes and simplifies the syntax of anonymous functions, until now considered very verbose. It’s now possible to write `
fn($x) => x*x;`.
Foreign Function Interface (FFI)
Using this extension, it is now easier to integrate PHP directly with libraries written in C.
PHP 7.4 includes a new mechanism for customizing object serialization with two new methods ( `
__serialize` and `
__unserialize`), that will replace the current solutions (the Serializable interface and the ‘
sleep()‘ and ‘
wakeup()‘ methods) , which will be progressively deprecated.
Ternary operator associativity deprecated
Nested ternary operations without parantheses are now considered obsolete and very soon will throw an error during compiling in PHP 8.0.
The idea behind this change is to remove associativity to the left of the PHP ternary operator since lots of other programming languages like C use associativity to the right of their ternary operator.
For more information on all of the changes in PHP 7.4, check out the PHP site.
As of today, if you want to use this new version of PHP on a Gandi Simple Hosting instance, you need to create a new instance. In a few weeks, we’ll open up the option to upgrade your PHP version to 7.4 on existing instances.
Before updating your PHP version, verify that your CMS (e.g. WordPress, Prestashop, etc.) or your code supports the new version!
Start working with PHP 7.4 with Gandi Simple Hosting today!