CALL 01707 378 807    SUPPORT     CONTACT US     CLIENT LOG IN

PHP 7: What you need to know

Do your sites run on PHP-enabled CMS such as WordPress, Drupal, Joomla or Magento? Here’s five things you need to know about the new PHP 7.


Brand new Zend Engine

Zend has been powering PHP since way back in 1999 when it was first introduced with the release of PHP 4. Zend is an open-source execution engine written in C that interprets the PHP language. Performance gains seen in PHP 7 are expected to be huge, with Zend claiming a realised performance enhancement varying between 25% and 70% just from upgrading to 7.


Twice as fast

 The most easily recognisable feature of the new upgrade is its speed. The new PHPNG engine is a significant performance improvement, with the development team re factoring the Zend Engine and even optimising memory usage. Simply put, this means code will be executed faster and fewer servers will be needed for the same amount of users. Some benchmarks show three times better performance running WordPress.


“To put things in perspective – when PHPNG was published, the WordPress homepage required approx. 9.4 billion CPU instructions to execute,” according to Zend. “As of now – it requires only 2.6 billion – that’s 72% less”.


Space ships

Good name – good feature. PHP 7 will introduce a new operator dubbed the Spaceship Operator <=> and as you can see it is remarkably similar to a TIE fighter (it seems that Star Wars permeates all things). It can be used for combined comparisons, mostly when dealing with sorting.


Declarations and Scalar Type Hints.

PHP7 will also allow developers to declare what kind of return type a specific function is expected to have (similar to argument Type Hints). These new return-type declarations, as well as the old argument Type Hints, now support scalar types. This will allow developers to specify whether they are expecting strings, floats, ints or bools to be passed or returned.


Add Anonymous Classes

PHP 7 will also enable the developer to use anonymous classes (a class without a name) – already a well-established feature in other object-oriented languages like C# and Java. The object it instantiates has the same functionality as an object of a named class and the syntax will be the same as what you are used to in PHP’s traditional classes – just with the name missing.


Properly used, these can speed up coding as well as execution time and are excellent when a class is used only once during execution or in situations where a class doesn’t need to be documented.


Leave a Comment