PHP 7 vs HHVM – which one to choose and why?

July 7, 2017

One of the favourite-most scripting languages of all times, PHP 7 is the topic of discussion again because of its newest version that greatly outperforms its nearest predecessor. It is successful at speeding up the performance and at facilitating Error Handling, while it enables accurate type declarations and adds anonymous classes. On the other hand, HHVM is a hip-hop virtual machine and is capable of nicely executing PHP code. The topic of the current discussion is making a choice between these two and the key reasons and motivation behind it. Major part of this discussion tends to go in the direction of comparison of speeds between PHP 7 and HHMV, which, if we look at it, is a rather straightforward metric. But then, there are circumstantial factors that also come into play while making a comparison of these two.

Facebook developed HHVM in 2010 and released it publicly the very next year. They designed it to reduce the server resources required to ensure the delivery of a faster web experience for the Facebook users. HHVM has the merit of quickly converting the PHP code into the machine code.

Pros of HHVM

1. HHVM gets a massive performance boost over PHP 5 because of the JIT compiler
2. Facebook itself using HHVM, is constantly working to upgrade it and this implies – a community support to depend on.
3. Because of the dynamic translation, the websites are usually able to run faster most of the times.
4. In case of HHVM, Hack, an internally developed language allows the programmers to use static as well as dynamic typing to better the compilation speed.
5. HHVM does not need much of the memory space for execution of the requests.
6. HHVM can be installed and worked on by any developers regardless of their skill-set.

Cons of HHVM

1. On adding any custom extensions, you will need to first convert them before using.
2. If Facebook stops to use and support HHVM, the currently existing large community for support and development will vanish.
3. While HHVM itself won’t support all the themes and plugins of WordPress, these need to be hacked to be used with HHVM.
4. HHVM was built using high end machines and has always been meant for the high-end machines so, it understandably doesn’t work with any 32 bit operating systems
5. More memory space is required by HHVM requires as compared to PHP 7, on making overall considerations. This may lead to a constrained selection of the server – the reason why it is not advisable to use HHVM on servers having RAM any less than 2 GB space.


As we begin to compare both PHP 7 vs HHVM, we notice that since HHVM and the PHP interpreter both execute the PHP code, the basic process of writing the code is essentially the same for both. It is also implied that before using HHVM, one needs to install it over the server and call it with the use of HHVM commands. The difference basically lies in the way both, HHVM and PHP 7 interpret the code.

PHP goes on to directly interpreting and executing the code on the server with the use of standard interpreter for PHP and this is available for free for everyone. The HTML code thus generated, then gets transmitted to the client – to be displayed to the end-user.

Whereas in case of HHVM, the code gets converted into Hip Hop bytecode before it is translated into the machine code and executed. This plays an important role in eliminating all the inefficiencies of the PHP code so as to significantly improve its performance.

Pros of PHP 7

1. PHP 7 has double the capacity for request handling as compared to its predecessor, PHP 5.6 and it is also quicker at responding to these requests.
2. In the latest version, PHP 7, the new features of the programming language comprise of uniform variable syntax and hinting of the return type along with some new operators.
3. With its altered way of handling the data the new version, PHP 7 manages the memory 3.5 times more efficiently as compared to PHP 5.6, its predecessor.
4. For PHP, there are many advanced communities to support the developers for issues such as troubleshooting and any other technical support that they may need.

Cons of PHP 7

1. PHP 7 does not support some of the PHP 4 features
2. In many, if not all of the performance metrics, HHVM stands out when compared to PHP
3. There are quite a few plugins and application themes that are not yet compatible with PHP 7.
4. With all these limitations, the use of PHP 7 is not recommended for websites with extraordinarily high traffic with one notable example being Facebook.


When compared based on the site load-time tests, both PHP 7 and HHVM perform about equally well. This is because PHP 7 is a significantly improved successor of PHP 5 in terms of performance and anyone who is accustomed to using PHP 5 will be able to appreciate the improvements that are part of PHP 7. The case with HHVM is that it makes use of lesser CPU resources and because of this, it can handle a higher number of requests and transactions at the same time. So, now the question arises, how to finally make a choice between the two.
All said and done, it ultimately boils down to your exact requirements and capacity. For example, for the websites that need to handle an exceptionally large number of requests at the same time, it is undoubtedly a great idea to consider using HHVM – given that you have a multi-core server that can support it. In most cases, however, PHP 7 would prove to be sufficient for handling the needs of most users – even for those who expect significantly better performance as compared to PHP 5.

To close the discussion, before you choose either of the two sides, you must ensure that your choice of the technology adequately meets your specific business needs, which is what matters the most. Because at the end of the day, if you leave a poorly performing website for the perusal of your prospects, it can have irreparably damaging impact on your brand’s image. So, rather than staying put with the old version PHP 5, you should make your move in either direction of improvement as soon as possible – PHP 7 or HHVM – which totally depends on your business needs. This will help your business stay competitive in the market.

We as one of the leading PHP development company holds over a decade of experience with executing PHP web development projects for its global clientele operating in diverse industries. We employ the most cutting-edge tools and techniques to come up with the most efficient solutions for your business problems or else you can checkout our ‘Hire PHP Developer’ service wherein you can evaluate our developers technical skills, approach to your project and their past work to choose from the industry’s most experienced talent pool.