Revolution of PHP 7: Usage of Return Types and Removal of Artifacts
As the date for PHP 7’s release is approaching rapidly, the group is working really hard to fix certain issues by removing the artifacts and adding some features. There are several RFCs on which we can discuss and study a lot more. But here, we are just concentrating on the three main points mentioned below.
- PHP 5.7 vs. PHP 7
- Return types
- Removing artifacts
1. PHP 5.7 vs. PHP 7: Most of the users might already be aware that PHP 5.7 has been down voted and is moving directly to the next version (PHP 7). It directly says that there are no other versions in between PHP 5.6 and PHP 7.
Even if the new version serves as a warning for those who are still stuck with an out-dated code, version 5.7 was not supposed to have new features; it was just supposed to throw out notices about the code which is set to change in version 7.
2. Return Types: Finally PHP is getting return types and so we’ll be able to indicate proper return types on functions. But the thing is there are no scalar values and also there are no return types like int, string, bool, etc. So, the methods and functions which return such values will remain unsigned.
While several users are complaining about strictness of PHP, few commenters state that they would get to know its value only when they start coding against the interfaces or when they inherit other people’s code. But as long as its existence doesn’t affect the performance or stability of PHP, there is no harm in it.
3. Removing Artifacts: PHP version 7 proposes to remove the style constructors of PHP4 (not confirmed; yet to be voted on). The removal of such constructors has got nothing to do with it. The effort would just go in vain if you try doing it here. But the interesting thing is the mental strain it’s causing some people.
But the experts’ advice that- those who don’t want to get upgraded to PHP 7, don’t! While you could use 5.2 or 5.3 for so long, you can certainly use 5.6 for a decade more. But those who are willing to accept just progress up and move on.
Below listed are some notable features of PHP 7:
1. Performance improvements: The main aim of PHPNG was to enhance the performance so that it could match the performance of Facebook Hip Hop Virtual Machine (HHVM).
2. JIT engine: The development of PHPNG was started with an inspiration to implement the JIT engine for Zend engine based PHP. A JIT engine is capable of compiling Zend opcodes into the native machine code which makes the code run faster when it is run for the next time.
3. Asynchronous programming: Asynchronous programming would allow the future versions of PHP to easily support the execution of parallel tasks within a single request while also helping in enhancing the performance of the PHP.
For More info :