Everyone Loves PHP
A year ago today, I started at Facebook. I've been using PHP for the last twelve years, and before I got there, I thought I had seen most PHP-related problems. I had deployed software on all manners of systems, but since I've worked at Facebook, my appreciation for how important PHP is has changed.
Earlier this year, another implementation of the PHP runtime emerged. This is nothing really new, as over the last few years, there had been several othersa€‰-a€‰Quercus, Project Zero, Roadsend, and phc, to name a few. The main difference between them and HipHop for PHP is in the numbers. Nearly all of Facebook's production traffic is served with HipHop. This consists of several million lines of code, worked on by several hundred engineers. Some run Apache and PHP; others run the HipHop interpreter.
One of the reasons for writing HipHop was to improve performance. The current Zend Engine is already pretty well optimized, and most changes result in a performance improvement of only a few percent. By building a code transformer, we were initially able to improve performance by 100 to 200 percent, and our current benchmarks show that in 2010, it's improved an additional 200 percent.
This isn't an article about HipHop and how awesome it is, though. What I'm trying to convey is our love affair with PHP. Take a look at the top hundred sites by traffic, size, or whatever other metric you fancy, and there is a high chance that they're using PHP.
One of the main reasons I think PHP has become so popular is the critical mass that it acquired while it was growing up, but what was the original cause of that? It all comes down to its simplicity and the other options that were available at the time. Back then, your host offered Perl, ASP, or PHP. Of those, PHP was the simplest to learn, write, read, and debug. This made the barrier to entry much lower than the others.
It became easy to take a basic html web page, change the file extension, and sprinkle in a few lines of code from the documentation to make it dynamic. Now, there is no guarantee that it's going to be good PHP, but the person who made the change was usually happy with the result.
Another reason PHP has become so popular is the documentation, which is second to none. It's almost always up-to-datea€‰-a€‰and not just in English. Its central location, user comments, and easy search, among other things, make it the best resource for learning PHP. No books are required if you already know how to code. Before PHP, my background was Perl, and reading the manual was all I needed to make the switch.
One of the biggest reasons for PHP's popularity is you, a member of the community. I recently discussed this with a friend, and we agreed thata€‰-a€‰especially compared to those surrounding other languagesa€‰-a€‰PHP's community is large, vibrant, and welcoming. There are dozens of user groups all over the world that meet on a monthly basis, along with larger conferences (and unconferences) that run throughout the year, all of which make it easy to be involved. One of my friends' observations, while attending PHP London, was that someone who had just picked up the language that day was able to talk with a couple of contributors to the language core. Attendees at PHP-related events form a diverse group.
PHP is now in its teenage years, and the enterprise market is finally starting to warm up. Companies that wouldn't normally have taken a second glance are now writing some large-scale systems with it. There are also a lot of companies built on providing consultation services, support, and training.
PHP's growing pains are starting to show, though. For example, there isn't a formal language specificationa€‰-a€‰the current implementation itself is the specification, and it's grown organically over the years. As things were needed, based on the trends of the Web, features were added. The last major version included closures, namespaces, and some other object-oriented goodies. The next version is going to include traits, scalar type hinting and some other languages changes. Developing modern PHP can be hard, but code written for PHP 4a€‰-a€‰for the most parta€‰-a€‰still works.
There is also no single entity or foundation that is responsible for the direction or funding of development. The majority of PHP's contributors are volunteers, doing so without any direct financial gain. The rest do so on behalf of their employersa€‰-a€‰Oracle, IBM, Microsoft, Yahoo, and Fac
Truncated by Planet PHP, read more at the original (another 3348 bytes)