On the Symfony Conference we've attended this November there were a lot of talks about the soon to be released Symfony4 with its main component Symfony Flex and about what's new and what differs from previous versions. The first speaker was Fabien Potencier, the creator of Symfony framework, who made a live demo showing what Symfony 4 offers in terms of innovation and how to deal with the new system. Another main focus was on the new version of php, php 7, and there were also a lot of speakers who advised the public to update to this version for its important improvements, the most important being the performance.
PHP 7 was a common subject in the conference, but one of the presentations was mainly focused on presenting the new features in php7. The speaker had shown a comparison between php versions, and the result was that PHP 7 is at least twice as fast as PHP 5 (based on request per second) and PHP 7.2 is 10% faster than PHP 7.1 - so it definitely pays off to upgrade.
In addition, PHP 7 brings several new features and some of the coolest are:
-introduction of strict scalar types declaration (int, float, string and bool). For example, in the call print(sum (2, '3', 4.1)) the 3 is no longer accepted and produces an error, since it is actually a string. Before PHP 7, the type hints were limited to 2 types: objects or arrays, so with this new feature it's hoped that more correct and self-documenting PHP programs can be written.
-the Spaceship Operator <=> , is a nice addition to the language, complementing the greater-than and less-than operators. Essentially what it does is check the each operator individually, the following image makes it pretty clear.
-the Null Coalesce Operator ??, is the new short syntax for "if-set-or". It will return the left operand if it is not NULL, otherwise it will return the right. The important thing is that it will not raise a notice if the left operand is a non-existent variable.