While PHP has made incredible progress in recent years, it continues to suffer ill repute. Some have even taken the extreme road of leaving PHP due to the bad rap alone. As of  StackOverflow's Annual Developer Survey for 2020, PHP still ranks high among the languages programmers most want to stop using with over 60% of its users "dreading" it. 😢

2020 StackOverflow Developer Survey, https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-dreaded

Considering that PHP has been the most popular server-side language in the last few decades, it has a unique paradox about it. Despite being known as a systemically flawed and ill reputed language, some of the most massively successful projects in the world have been built with it. Renowned blogger and StackOverflow co-founder Jeff Atwood noted this back in 2008:

The TIOBE community index I linked above? It's written in PHP. Wikipedia, which is likely to be on the first page of anything you search for these days? Written in PHP. Digg, the social bookmarking service so wildly popular that a front page link can crush the beefiest of webservers? Written in PHP. WordPress, arguably the most popular blogging solution available at the moment? Written in PHP. YouTube, the most widely known video sharing site on the internet? Written in PHP. Facebook, the current billion-dollar zombie-poking social networking darling of venture capitalists everywhere? Written in PHP. (Update: While YouTube was originally written in PHP, it migrated to Python fairly early on, per Matt Cutts and Guido van Rossum.)

Notice a pattern here?

Some of the largest sites on the internet – sites you probably interact with on a daily basis – are written in PHP. If PHP sucks so profoundly, why is it powering so much of the internet?

- Jeff Atwood, PHP Sucks, But It Doesn't Matter

Now, this is a really curious case. Why, indeed, is a deeply flawed language powering so much of the internet? There must be redeeming qualities of this language we're not talking about — the good parts.

The good parts

One of the strengths of PHP is its natural state isolation. Every PHP process maintains its own state which is independent of any other process. And without external stateful components, PHP is generally unable to share state between its processes. Since a process lives and dies with the web request it handles and it always starts with a known clean state, the result is a natural state isolation between web requests such that no process contaminates other process states nor does a messed up state in one process affect another.

To complement, PHP has an excellent concurrency model. While it handles web requests in single threaded fashion, it is able to achieve concurrency by operating within the context of a web server. Unlike most general purpose languages, PHP was originally a simple templating language for HTML. To actually serve web requests, PHP has been (and is) generally dependent on a web server. This dependency, however, has conversely given PHP applications a natural source of concurrency — web requests themselves!

Finally, PHP allows for a rapid development workflow. Making code changes then reloading a page is typically a taken for-granted workflow in the PHP world. And while a similar behavior may be achievable in other languages (e.g. via automations), such approaches are slower and introduce additional moving parts which occasionally do stop moving. The tight feedback loop facilitates the rapid prototyping, testing, and debugging developers enjoy when working with PHP.

Getting better

PHP is especially suitable for the web but the inherent language flaws have been a serious barrier in promoting the development of high quality software as well as a good reputation. As have been countlessly repeated, PHP makes it way easier to write crappy than elegant code.

However, the progress made to address its language level flaws are nothing short of impressive. The advent of Hack/HHVM and the release of PHP7+ introduced immense performance improvements and better language capabilities (such as strict type declarations); the PHP Framework Interoperability Group has crafted PSR standards which have gained wide adoption in the community; frameworks and libraries (such as Symfony, Composer, PHPUnit, PHP-Parser, etc.) have made bold headways to improve the quality, productivity, and rigor of PHP development, by creating highly re-usable components and expediting standards adoption. These may largely be invisible from the outside but there have been huge movements inside the community to organize and advance the language.

Infamy

Perhaps the greatest issue of PHP right now is not the language but its reputation. For over 2 decades, PHP's low barrier to entry has invited poor programming practices and along with it a generally poor opinion of any PHP programmer.

It may take more time before the advances within the community gain  outside recognition and for PHP to be seen more as a spectrum — while having low barriers to entry on one end it also supports rigorous development standards on the other. PHP need not just be the "get it done" tool which benefit businesses but also a respectable language for developers to be using.

Onward

Perhaps we can chalk it up to a lack of insight of PHP's virtues or simply the sheer number of shiny alternatives abounding (JS is booming like crazy recently); PHP's lacking popularity with some developer communities poorly reflect its excellent suitability for building modern web apps.

PHP's success suggest that despite its flaws, it has gotten some big things right and its understated strengths likely outweigh it language-level deficiencies. With the constant improvements rolling in on top of a battle tested base, PHP rapidly continues to move towards becoming a more reliable, enjoyable, and respectable language for building software.