PHP 7.4 was released on November 28, 2019. It’s a relatively minor release, and is supposedly the last before PHP 8.0, which is rumored to have in store some more dramatic impacts on website performance.
One thing that’s staggering about PHP versions is just how many websites out there are running a version that is out of date, or even worse, a version that is so out of date is no longer even supported. According to the official WordPress Stats page, 64% of all WordPress websites are utilizing unsupported versions of PHP. Only 13% are using PHP 7.3, the latest version until this release. Over 30% of websites are still running on PHP 5.6 or earlier.
As you’re migrating to PHP 7.4, keep in mind these new features and backward incompatible changes.
Class properties now support type declarations.
Arrow functions provide a shorthand syntax for defining functions with implicit by-value scope binding.
Limited return type covariance and argument type contravariance
Full variance support is only available if auto-loading is used. Inside a single file only non-cyclic type references are possible, because all classes need to be available before they are referenced.
FFI is a new extension, which provides a simple way to call native functions, access native variables, and create/access data structures defined in C libraries.
The username and password can now be specified as part of the PDO DSN for the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this was only supported by the pgsql driver. If a username/password is specified both in the constructor and the DSN, the constructor takes precedence.
It is now possible to escape question marks in SQL queries to avoid them being interpreted as parameter placeholders. Writing ?? allows sending a single question mark to the database and e.g. use the PostgreSQL JSON key exists (?) operator.
If you need more technical specs on PHP version 7.4, or want a longer list of changes and updates, visit the official release website.
cPanel support for PHP 7.4 is right around the corner, and as soon as it is available, CanSpace Solutions will be making PHP 7.4 available to all our clients. Stay tuned for more updates!