When a beginner picks a specific programming language to learn, they usually weigh a few things. Depending on why they want to learn to code, they may care about how hard the technology is and what it is used for in practice. But two more aspects deserve attention: the community (the bigger it is, the easier it is to find tutorials and solutions to problems) and technical quality. With a well-known language like PHP, hardly anyone doubts that the community is thriving, but almost everyone has doubts about the quality.
In this article we look at whether those doubts are justified.
What is PHP?
PHP (originally Personal Home Page, with "Forms Interpreter" or "Tools" added in the early days) is an interpreted scripting language designed for building dynamic websites. That is still what it is used for today, although over the years it has also become possible to build desktop applications with it. PHP grew out of Perl scripts written by Rasmus Lerdorf, who used them in 1994 to track visits to his own website. A year later, after rewriting them in C, he released the tools to the world. The language then developed on its own and was officially released in 1997. After that, Zeev Suraski and Andi Gutmans took an interest in it, took over development and built a new interpreter engine named after themselves: Zend Engine.
The popularity of PHP is best shown by the fact that in 2012, 77.5% of all websites on the Internet turned out to be written in it. That share is probably somewhat lower today, but the technology is still widespread. It also benefits from the fact that the main CMSs on the market (WordPress, Drupal and others) are built on it.
And paradoxically, it is this very popularity that makes PHP so heavily criticized. Not entirely fairly, and that is what I will try to explain. Keep in mind that the language is still being developed. Version 8.0 came out in 2020 and brought many useful features while keeping the language easy to use. For completeness: PHP is used mainly on the backend, although it is perfectly possible to build entire applications in this one technology, for example with various view template engines.
Is PHP ugly and does it encourage bad practices?
This is the main charge against PHP. Because of its history and the lack of a clear direction early on, the standard library can be odd. For instance, little care was taken to keep the order of function arguments consistent (especially visible in functions that work on arrays). It is also a multi-paradigm language, which means you can mix different styles. That is convenient on the one hand, but on the other it makes it easy to create a mess in the code and leave behind code smells.
It is true that many PHP applications are written badly, but the reason is something else. The popularity of the language and the sheer number of tools mean that a great many different people are interested in all of it. Among them are people who are not professional programmers. They not only don't know how to design good architecture, they are also simply more likely to make mistakes (and have every right to). Since this is a lot of people writing a lot of code, statistically you are more likely to run into ugly scripts in a PHP project than in other technologies that are less accessible to beginners.
So it is worth remembering that you can write really clean, well-architected code in PHP. That is the kind of code you get in an application built by professionals who know what they are doing and have seen plenty of lines of code in their lives. It is true, though, that because of the huge amount of PHP code out there and the flexibility of the language, you are more likely to find truly strange solutions on a randomly chosen PHP website.
Does PHP make it harder to develop an IT system?
This concern is related to the previous point, and the answer is: not when the approach is professional. The story is very similar to the one about "ugly" code. With such a huge number of PHP applications, it is easy to find ones that were built in a hurry and focused on working "somehow", with no thought for the flexibility that allows (or at least doesn't hinder) further development.
PHP does not stop a programmer from designing good architecture. On the contrary, the available frameworks make it easier to build small backends and to split an application into many modules or sub-applications. On top of that, thanks to its popularity, practically every ready-made hosting plan lets you deploy PHP software, which makes it an easy choice. That includes horizontal scaling, because nothing prevents you from building stateless applications.
That said, it is worth knowing that the ease and flexibility of the language are tempting enough that even an experienced programmer can fall into a trap and build something that comes together quickly but later needs refactoring. This is both an advantage and a drawback, but professional teams know how to spot such problems early and fix them, or simply avoid them.
Is PHP slow?
This is a legitimate concern, because PHP is an interpreted language, so the interpreter processes it on the fly while the script runs. By nature, such technologies are slower than those that are compiled ahead of time or at least prepared in some way. For quite a while now, though, PHP has been really fast. You can see it clearly in the comparison in this article, which shows that the mechanisms introduced in PHP 7 and developed further in PHP 8 (including the JIT compiler) deliver the intended result.
Compared with other languages, PHP is indeed not the fastest option, but it isn't bad either, as this article shows, among others. As you can see, PHP lags behind Go, for example, in performance, but two things are worth noting. First, it is more "friendly" in other respects than those two languages. Second, we don't always need a super-fast application, and in a typical case the differences are not noticeable in practice.
Is PHP outdated?
Given the history of PHP and its persistent attachment to some solutions from long ago, the language can seem outdated. But as mentioned, it keeps evolving and has been mature for a long time. Typing, object-oriented programming, asynchronous code and many other features that help in everyday work are all possible. It is also a technology that supports and integrates with many others, which makes it really flexible. Of course, in general the newer a technology is, the better it fits modern solutions, but PHP, as a language that is still actively maintained, keeps up with what web applications need.
Is PHP only suitable for small applications?
Absolutely not. Over our careers we have built a great many small and medium-sized applications, and large ones too, all based on this technology (here is just a fraction of them). Each of them needs a different approach, a different internal structure and sometimes specific frameworks. Still, nothing stands in the way of using PHP for a tiny brochure site for a local business as well as for a huge system that manages an entire company. Of course, it all depends on the situation, and there are projects where an engine based on another specific language makes more sense (usually because of specific requirements or a team with a particular focus). But the argument that you can't build giant software in PHP is rather funny when you see tools like Yii 2, Laravel or Symfony.
Summary
Is it embarrassing to use PHP? Not at all. Despite its long history, it is still a language worth your attention (especially for the backend), and it is used above all by small and medium-sized companies (and by large ones too, although there Java, for example, has more say). It lets you build a really wide range of high-quality web applications, and beginners love it because it is easy to get started with. Yes, that simplicity can be treacherous, which is how "monsters" come about, written by programmers unaware of the dangers. Still, there is certainly no reason to frown when PHP is one of the technologies considered for a project, especially when the cost of the undertaking is taken into account.
Best regards and thank you, Jakub Rojek.


