DEV Community

Cover image for Why is PHP losing popularity?
Alexandre Bento Freire
Alexandre Bento Freire

Posted on

Why is PHP losing popularity?

If you compare the user base of PHP with languages like Python or JavaScript on platforms like LinkedIn or Reddit, the difference is striking. PHP's position on the TIOBE Index has dropped from 7th to 13th.

Is PHP dead? No, but its trajectory is concerning. While languages like Python and JavaScript continue to attract developers, PHP struggles to shake off its limitations and old perceptions.

For years, PHP was closely associated with WordPress, which many developers dismissed as "not real programming." Those days are largely over. PHP has evolved with new versions, and frameworks like Laravel and Symfony have made the language more elegant and powerful. Yet, developers continue to migrate elsewhere.

Why?

PHP’s core design still suffers from early decisions made to solve simple backend tasks. Unlike JavaScript, which learned from its past and grew substantially, PHP retains significant inconsistencies, acting as a drag on its growth.

Examples:

  • PHP's function names and argument orders are notoriously inconsistent.
  • Arrays default to hash keys, introducing inconsistencies in functions like array_merge. Workarounds like SplFixedArray exist, but shouldn’t be necessary.
  • Even something as simple as using preg_replace with a regex often fails in PHP, while the same works flawlessly in Python.

These issues are compounded by PHP’s reliance on frameworks to mask its flaws, whereas Python and JavaScript focus on core language improvements.

Even Facebook, now Meta, created Hack to address PHP’s shortcomings. However, it never gained mainstream traction.

I’ve worked with PHP since its early days and still maintain Laravel projects today. However, many of us stay with PHP out of necessity rather than choice—it’s often too costly to migrate existing codebases.

If PHP wants to remain relevant, it must listen to its users, assess its shortcomings, and evolve. Otherwise, it risks becoming another COBOL: alive but primarily for maintaining legacy systems.

What are your thoughts on PHP’s future?

Top comments (2)

Collapse
 
xwero profile image
david duymelinck • Edited

JavaScript focus on core language improvements.

For years people use languages like coffeescript, typescript, Elm, and so on to hide the javascript code. And PHP relies on frameworks to hide the inconsistencies?
The solutions to run javascript on a server moved to typescript, for example bun and deno.
And even the "grandfather" solution, node, has an option to run typescript.

So not listening to users, or having inconsistencies is not a problem for a language. The only reason javascript is popular is because it is the only language that is embedded in browsers.

For python the github statistics are 50% data science and 25-30% web development.
PHP more or less is a one trick pony because the main use case is web development. I think that is what people don't like about PHP.

Most big backend languages are general purpose, and have frameworks for specific tasks including web development.
Compiled languages are more performant than script languages. Even with all the speed improvements that have been added over the years.

As long as there is a big community that is passionate about PHP, it will thrive. Going to php conferences and seeing the crowds getting bigger every time, I'm not afraid it is going to die soon.

Collapse
 
gromnan profile image
Jérôme TAMARELLE

Even something as simple as using preg_replace with a regex often fails in PHP, while the same works flawlessly in Python.

Could you elaborate on the issue you spot?