There is “this language” which runs more than 50% of the Internet. Some say over 80, and who knows what is the most accurate data anyway. Given the fact that the language we’re talking about runs WordPress, Drupal, Magento and alike, it’s not hard to believe there’s a major hype around the newest edition.
PHP 7 is here and it’s more than popular – for a reason!
Most popular web language recently got a makeover. A complete one. After PHP 5.6, we are now looking at PHP 7 which stands for a revolution in the way we deliver applications that power everything, from websites to cloud.
You might wonder what happened to the inbetween version. Yes, guys at Zend are quite aware there is a number between 5 and 7. The thing is – there was a PHP 6 in the past, but only as an experimental project. The version never reached the production phase. So, to prevent users from mixing up the former attempt with the latest release, the new major edition runs under the name PHP 7.
(Also, it is said that 7 is a lucky number – both in Chinese culture and the Western world, and who wouldn’t want some luck in their life?)
To explain the importance of PHP 7 for Magento, we asked one of our developers, Ivan Curdinjakovic, for his opinion regarding the release. Here’s what he noted:
Magento 1 is not officially compatible with PHP 7, but it’s easy enough to patch it, and well worth it. PHP 7 constantly gives double the performance of PHP 5.6, with all other things (MySQL, OpCache setup, hardware, etc.) being the same.
If you make a calculation of the exact hardware upgrade you would need to get that kind of performance with PHP 5.6 on any specific store, and the cost of it, you’ll get a healthy appreciation of the kind of upgrade PHP 7 is on any project.
What’s more important, PHP 7 improves performance everywhere, including the worst case scenarios, while other technologies, like caches (Varnish, Redis, etc.) improve only the best case scenario. And it works on a completely different level, so you can combine all of that to get a really, really fast Magento 1 store.
But performance is not all there is to PHP 7. There are also some very interesting new features. My personal favorites are much improved input type hints and return type declarations, as well as the null coalesce operator. They help preventing a whole class of bugs and security holes, as well as making code more self-documenting.
While these new features in PHP 7 are not used even in Magento 2 core, nor in 3rd party extensions, because they need to keep compatibility with PHP 5.5 & 5.6, we, as a custom solutions provider, are in a different position. If we know our client’s project is on a PHP 7 server, we can unleash all these goodies in our custom code. Ah, it’s a good life working at Inchoo.”
To sum it all up, PHP 7 comes with long awaited advantages our developers are enjoying working with. From the significant performance improvement, handling fatal and catchable errors, to accurate type declarations and null coalescing operators.
Now, since the holiday season already started, we got something coming up this Friday – make sure to stay tuned. Inchoo prepared something that will spice up your holidays and working with PHP 7 and Magento better than Christmas decorations and mulled wine.
In the meantime, what are your thoughts and comments on PHP 7? We’d like to know so don’t hesitate to share. 🙂