PHP has been around forever. In fact, it's still the most popular back-end language for the web and cloud. According to a recent survey, 78% of the internet runs on PHP!
Before PHP 7, one of the biggest shortcomings was the language's slow processing time. Thankfully, those days are behind us. In fact, at Tragic Media, we have a bold take.
You should consider PHP for your website or application in 2020.
Looking Ahead to PHP 8
To start, we want to provide some context by walking through PHP 7.
Over the last several years, the PHP community has focused on increasing the performance of the programming language. In particular, Facebook's HHVM project brought much needed competition to the internal PHP team.
With the official launch of PHP 7, there were massive performance gains over older versions.
For instance, Kinsta found that PHP 7.0 could handle 2.6x more requests per second than PHP 5.6 running on the same hardware! Moving to PHP 7.4 saw that delta jump up to 3.2x more requests per second.
Looking ahead to PHP 8, there are a whole host of features to get excited about. We are going to focus on a handful that we are most excited about.
PHP 8 and the JIT Compiler
First and foremost, PHP 8 introduces the Just In Time (JIT) compiler.
As we said, the focus for years has been increasing performance and we anticipate that there will be another jump when going from PHP 7 to 8. In particular, the "JIT performance benefits will primarily be for CPU bound code paths" and the JIT compiler "is seen as the next major advancement for opening up better performance out of PHP" (source).
We are now going to explore this last point further.
There are several ways that your application could be bottle-necked. For this discussion around PHP, we are going to focus on two points: CPU limited processes and input/output limited processes. (For a more technical look, here is an excellent article.)
An application is CPU limited if more processing performance alone (e.g., higher CPU clock speeds) would improve the throughput of the application.
By contrast, an application is input/output limited if it's stuck waiting to connect to a source, writing data to a cache, reading data from a database, and so on. By and large, PHP applications are usually input/output limited.
So wait, I just stuck through a technical conversation to learn that the JIT compiler improves the performance of the minority of PHP applications? What's going on here?
How Should I Think About JIT?
Given that the Just In Time compiler is designed to make CPU bound processes faster, it is unlikely that your website or web app will run much faster. There might be a slight improvement, but nothing groundbreaking.
PHP 8 with JIT was specifically designed to make a big difference on processes that are CPU limited. In other words, this opens the door for PHP to be used at scale in data analysis, machine learning, 2D and 3D rendering scenarios, and much more.
Areas that were previously off limits for plain old PHP 7.
Furthermore, this means that if you have a PHP application and you want to add a data analysis component, you can build this new feature or application in PHP as well. (Instead of having to break out to another language, like Python, for example.)
This was the strategic decision by the lead PHP developers to open the programming language up to a new opportunity. We believe that PHP is far from being an outdated tool – what do you think?
Want to see if PHP is a better fit for your project than Python or Ruby? Contact us for a free recommendation analysis.