What does PHP offer now?

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

I’m writing in response to something on Hacker News:

The thing is, when I started using PHP in 1999, PHP had real advantages that no other eco-system offered. Regarding functionality, it had an “all in one” philosophy, whereas Perl had exactly the opposite attitude. With Perl, the first thing you had to do was research which modules you would have to download and install, but with PHP you could just start writing code. This was in the era before modern package managers, so it was a very big deal. PHP was open source, so it was a good choice relative to classic ASP. Worst of all, other languages, such as Java, were engaging in an orgy of unnecessary complexity, especially when it came to frameworks, of which Struts was perhaps the most awful exemplar. PHP was the first language to make automatic adaptations to the world of the Web, including loading $_POST and $_GET variables automatically — some of these decisions were later seen to be huge security liabilities and so they were ended.

Above all else, circa 2000 we could still rely on Moore’s Law and therefore we could rely on a single CPU getting faster and faster every year. But once Moore’s Law came to an end, it became increasingly important to be able to leverage concurrency, and PHP had no real story around concurrency (except the course-grained method of starting a new process).

PHP 4 was a very easy language to learn. It did not have many Object Oriented features, instead it encouraged a simple style of simple functions. Ironically, when it came to objects, the default behavior was “pass by value” so PHP 4 was, in a sense, an immutable language, long before that became a popular development style (tragically, it was not optimized to manage memory in a manner that would allow ambitious use of its immutable qualities).

Later, PHP developed an intense envy of languages that were seen as “enterprise ready languages”. This lead to a lot of nonsense. First of all, PHP 4 was already good enough that it could be used in an enterprise, but this fact was ignored. Second of all, PHP 5 suddenly adopted a lot of Object Oriented features which added a lot of complexity to the language, but without offering the benefits that might have come from using a language like Java, such as compile time checks.

I used PHP from 1999 to 2011. I built my first and second startups using mostly PHP. However, in the year 2020, I can not imagine why anyone would use PHP. It no longer offers the simplicity that it offered in 2000. It no longer offers the straightforward procedural style that it allowed in 2000. It’s “all in one” philosophy is no longer an advantage because now every language has a modern package manager that makes it easy to include whatever is needed. Nowadays, with Javascript, you just type “npm install” and you get every module that you need. And yet PHP still doesn’t offer some of what a complex language like Java or C# might offer, especially regarding strict typing or compile time checks or run time efficiency, or a separate set of runtime flags for a compiled version. PHP has become a weird mutant, imitating the more complex languages but without offering their benefits.

And crucially, the other languages have not been stagnant. The community around Java eventually gave up on Struts and started developing light-weight frameworks that made development much easier. And there sprang up dozens of languages that run on the JVM and which offer a wealth of good ideas about how to do modern development. (I became a huge fan of Clojure.)

I seriously can not imagine why anyone would use PHP now. It no longer offers simplicity, but developers don’t gain much from all the extra complexity that’s been added. Source