What’s New in PHP 7 You Should Know



Community of PHP developers is eagerly waiting for launch of PHP 7, which was expected to be a reality by mid of October but  finally wait has been over and as per the PHP wiki it’s going to be launched by Today itself.

PHP 7 will be released today after releasing 2 Alpha, 3 Beta and 8 RC versions.

Following snapshot illustrates the history of GA release of PHP 7.



Some of major features which are included in PHP 7.


Performance Improvements

As per performance benchmarks, PHP 7 can handle twice as many requests per second, PHP 5.6 could handle. Zend claims that performance would vary between 25% to 70% for real world applications. Memory usage will also be significantly lower as compared to PHP 5.6 

This is the most important reason you would opt for switching to PHP 7 over PHP 5.6. PHP 7 is based on a project call PHPNG, initially was used by Zend to improve performance of PHP applications.  Zend shared some of their test cases comparing different frameworks and content management systems, some of which have been shown below. You would be amazed to view the difference in speed and that’s something you will get without changing anything at all in your application, obviously apart from fixing some codes if you are using old fashioned line of codes.














Spaceship Operator

A new operator <=> named as ‘Spaceship Operator’ has been introduced in PHP 7. It will work on all standard values of PHP. But why they named it as ‘Spaceship Operator’ ?? Because that’s what it’s called in most of other languages like Perl, Groovy & Ruby.

If both operands are equal then it will return 0, and will return 1 if left is greater, and -1 if right is greater.

It will have the same precedence as == and !=.

Following snapshot will get you an idea about possible cases.


SpaceShip Operator


Scalar Type Hints & Return Types

Developers can now declare return type expected by function in PHP 7.

Here is the brief example of syntax :

function foo(): array {
    return [];

This does not mean that you have to specify the same for all of your existing code, existing code will keep on running exactly as it is.

Scalar type hinting is another cool feature included in PHP 7. This means that type of functions parameters and return values can be declared as int, float, string and bool.

This will help to prevent programming mistakes as PHP runtime engine will make sure that type of parameters passed and type of return value should be same.

Apart from points mentioned above, some of following noticeable improvements has been included in PHP 7 which we will be covering in our next blog.


  • Many fatal errors converted to Exceptions
  • Removed old and unsupported SAPIs and extensions
  • Anonymous Classes
  • Consistent 64-bit support
  • Improved Exception hierarchy
  • The null coalescing operator (??)
  • Zero cost asserts
  • Abstract Syntax Tree
  • Secure random number generator


Sandeep Kumar

Sandeep Kumar is a web consultant having experience of more than 9 years in website development, Brand Promotion, Digital Marketing and Social Media Marketer. Sandeep consults, develops, speak and write about building high quality web based solutions. He loves to interact with people and believe that communication is the key to success and helps to solve complex problems. He can be reached at sandeep@calipus.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>