The next minor release of PHP 7, PHP 7.4 is expected to release on November 28, 2019. PHP 7.4 will boost website performance, speed and improves code readability. Right now the beta version of PHP 7.4 is available. PHP 8 will be the real milestone for PHP.
What’s new in Php 7.4?
PHP 7.4 comes with a lot of new features. Some of the features that will boost your website performance are :
- Array Spread Operator
- Arrow functioning
- Support null coalesce assign(??=) operator
- WeakReferences
- Preloading
- Typed Property
- New Custom Object Serialization Mechanism
- Deprecations
Array Spread Operator
The spread operator support for argument unpacking is already existing in PHP 5.6, and this RFC expands on the usage of arrays.
Example : $parts = [‘apple’, ‘pear’];
$fruits = [‘banana’, ‘orange’, …$parts, ‘watermelon’];
Spread operator works for both array syntax(array()) and short syntax([]). String keys are not supported.
Arrow functioning
Arrow functions also called “short closures”, allow for less verbose one-liner functions.
Support null coalesce assign(??=) operator
PHP 7.4 has also introduced a shorthand method for coalesce assign operator.
Example : $someArray[‘key’] ??= ‘someValue’;
WeakReferences
WeakReference allows programmers to retain a reference to an object that doesn’t prevent the object itself from being destroyed.
Preloading
Preloading allows the server to load PHP files in memory on startup, and have them permanently available to all subsequent requests.
Typed Property
Typed class properties have been added in PHP 7.4 and provide a major improvement to PHP’s type system. These changes are fully opt-in and non-breaking to previous versions.
New Custom Object Serialization Mechanism
PHP 7.4 will implement custom serialization of objects to solve all the issues with PHP object serialization.
Deprecations
PHP 7.4 will release with some new deprecations. Let’s see what they are:
- Short Open Tags
- Left – associative ternary operator
- Deprecate Curly Brace Syntax
Do you own a website or application in PHP? Do you want to develop a website in PHP 7.4?
We are ready to help you. Please contact us on [email protected] or on social media(twitter/facebook)