PHP 7 Now Available on the Cloud

PHP 7 Now Available on the Cloud

Wooh where’s PHP 6?

First things first – where’s PHP 6? Whilst PHP 6 was originally planned and being developed, due to the time taken to implement some of the bigger changes at the very core of the language, new features planned for version 6 were instead added to releases in version 5. Eventually it was decided that, since most of the features planned for 6 had now been added to the language, that they’d jump straight to version 7 instead.
New PHP 7 Features

PHP 7 has a lot of new features that I can’t cover in depth but, I’ve pulled out some of the more exciting new features:

Improved performance: As part of the update, large parts of the PHP interpreter have been rewritten to improve the speed at which PHP executes code. This is achieved by reducing the number of CPU cycles required. The changes have resulted in improvements on real world tests from anywhere between 25% all the way up to 70%. All this without changing a single line of code of the applications.

The “Spaceship” operator: Also known as a combine comparison operator, the <=> operator allows you to compare two different expressions and return whether the expression you’re checking is smaller, equal to or greater than what you’re checking it against.

Scalar and return type declarations: It is now possible to explicitly specify what sort data types a custom function will accept and return. You can also set the strictness of these declarations which will tell PHP whether to try and convert data types or throw exceptions.

Null coalesce operator: An improvement on the existing ternary operator which allows you to directly compare whether the item you’re checking. Previously if you wanted to see if a variable was set and take action accordingly you’d need to combine the ? operator with the isset function. The new ?? operator lets you do this without needing to call another function.

Filter unserialized data: The unserialize function, used to take serialized arrays and convert them back into standard arrays, now has the ability to apply filters to the data being converted. This means it is now easier to handle the unserializing of data, especially from untrusted sources, in a much safer way and reduce the risk of code injection.
Compatibility

Whilst PHP 7 makes a lot of changes, it is largely designed to be backwards compatible. Therfore it should be possible to upgrade without any issues however, we highly recommend that you check the compatibility of your scripts before making the upgrade.
Using PHP 7 on your Cloud account

Our Cloud Web Hosting allows you to run different PHP version on a per site basis. You can update your site to use PHP 7 from wihtin your control panel in just a few clicks. To change your PHP version between 5.2, 5.3, 5.4, 5.5, 5.6 and PHP 7 follow these steps:

Step 1. Log in to your control panel.

Step 2. Ensure you are managing the website you would like to update. Locate the ‘Advance Management Tools’ section and click the ‘PHP Version’ icon.

php7_1
PHP_7_2c

About the Author

Comments are closed.