In addition to PHP 5.6 and 7.1 you can now run your website on PHP’s newest release as well! Yes, we’re talking about PHP 7.2. When PHP 7.0 was released two years ago it came with a massive boost in speed. With PHP 7.1 and 7.2 the focus on speed was continued alongside other things. In comparison, PHP 7.2 is now 250% faster than the 9 years old PHP 5.3.
Speed is of course not the only improvement the team has made with the release of 7.2, as some functions have been deprecated and new ones have been introduced. In the end PHP 7.2 offers developers more possibilities, which makes building web applications easier and safer. In our eyes these are the highlights of the 7.2 release:
- 'Type hints' can now be used with the object data type. This improvement allows you to declare a generic parameter as a method/function.
- It’s now possible to return an object data type within a function, in earlier versions this would cause a fatal error.
- You can now leave out a type in a subclass without breaking your code.
- You can use trailing comma’s in grouped namespaces.
- Improved security with the help of the new Argon2 hashing algorithm.
That said, we’ve also stumbled upon a somewhat unfortunate ‘bug-fix’ as the count() method in PHP 7.2 has been changed and now only allows arrays and countable objects. For example: the latest release of Laravel (5.4 as of this writing) doesn’t work under PHP 7.2 and the same is most likely true for other frameworks and content management systems such as Wordpress.
For more specific information on the release of PHP 7.2 then we recommend to check out the release notes on the website of PHP: http://php.net/releases/7_2_0.php
How do I enable PHP 7.2 for my website?
If you use a PCextreme webhosting plan with PHP support then you can change the PHP version of your website through the WSCP using the backend selector. These are the steps to take:
1. Login on the WSCP with your customer ID and password
2. Select the webhosting plan you want to apply the changes to
3. Go to ‘Settings’
4. Change the PHP version next to the ‘Backend’ heading
If you are unsure whether the code of your website uses functions that are no longer supported with the new PHP version, then we recommend to test if your website still works as it should. If something doesn’t work properly after the switch then you can easily revert to an older PHP version using the steps outlined above.