Pourquoi les développeur(euse)s détestent PHP

Why developers hate PHP

PHP is the most widely used language in the world for websites. It is also the most hated. And it’s pure hate. But why do so many developers hate it so much? Today we’re going to the origin of the hate, let’s see if it’s really justified.



Don’t touch my PHP

If I’m saying that PHP is hated by the whole world, it’s not my personal opinion. In the latest stack overflow survey, developers from all over the world put PHP in the top 5 most dreaded languages. The latest Hired survey puts it squarely in the top 2 most hated. There’s a lot more and I’m not even talking about what’s going on Reddit. If you’re a PHP developer since 20 years who came here on a crusade to crucify me on the altar of Symfony, please relax. We’re here to talk, put the gun down. Well now on the contrary if you hate PHP with passion : take some pop-corns and sit down comfortably.

Once upon a time I was doing some Symfony2 myself. And I liked the whole Symfony thing, frankly, it’s not bad. I told this to a developer I met at a devops meetup. He was shocked, he was about to vomit, he looked at me like I just murdered a newborn baby. From now on I’m going to call him James to make it easier. So I immediately asked James a question: why so much hatred?



PHP trouble past

To understand what’s coming next, you need context. In order to do that, let’s make a little rewind. It’s 1994 and Rasmus Lerdorf is quickly coding a C tool suite. This suite of tools is used to manage his personal website. Rasmus is doing it just for his own need at the time. He doesn’t want to turn it into a programming language. Nothing in this tool suite is designed to become one. A year later Rasmus released this open source toolkit called then: PHP/FI. And it looked like this.



<!--include /text/header.html-->

<!--getenv HTTP_USER_AGENT-->
<!--ifsubstr $exec_result Mozilla-->
  Hey, you are using Netscape!<p>
<!--endif-->

<!--sql database select * from table where user='$username'-->
<!--ifless $numentries 1-->
  Sorry, that record does not exist<p>
<!--endif exit-->
  Welcome <!--$user-->!<p>
  You have <!--$index:0--> credits left in your account.<p>

<!--include /text/footer.html-->


We’re far from what you’re using today in your huge PHP7 framework, aren’t we? Yet it all comes from there. For the rest of the story : the code is taken over by a dev team and PHP/FI2 is released in 1997. In 1998 a part is rewritten and PHP3 is released. In 1999 the core of PHP is totally rewritten to produce Zend. PHP4 follows the next year and PHP5 is released in 2004 with Zend2. PHP6 got canceled because the development has turned into hell on earth. Finally, through yet another major rewrite of the language: PHP7 is released in 2015. I remember at the time I was very excited. But originally, Rasmus was just coding his own thing . In 2003 he did an interview and told some incredible things.

“I really don’t like programming. I built this tool to program less so that I could simply reuse code … I don’t know how to stop it, there was never any intention to write a programming language […]. I don’t know how to write a programming language at all, I just kept adding the next logical step.”





Inconsistency and poor design

Back in 2019 with our friend James from the meetup. He immediately started talking to me about the “disgusting” syntax of PHP. How the language is not typed. How the language is mostly unpredictable. Whether it’s on the use of operators or the incredible inconsistencies in function naming. I’ll spare you the list of technical problems because otherwise this article will take you all day to read.

If you really want to know everything I found you the most pissed off person in the world against PHP. No, actually I think the person who hates PHP the most is actually him. All those posts validate what James was telling me. Developers hate PHP because it’s a technically inconsistent language with a bad design. When you compare it to other languages the contrast is obvious. If after reading these two articles you can’t admit that PHP have some problems it’s because it became your religion. And I stopped trying to convince fanatics.





Using PHP it’s very easy to produce bad code. Other languages have many more restrictions. We also see a lot of security problems with PHP. And the problem is the same here. It’s very easy to make bad and insecure code with PHP. But PHP is not a security hole or doomed to ugly code if you code properly. Developers hate PHP because you are more likely to get errors with a language that allows so much freedom.



Victim of its success

There is another important factor in this ambient hatred. Developers hate PHP because it is used everywhere. This blog runs on PHP7. Like most of the web I just need to host a dynamic page which is then cached. PHP does the job. Yes the language itself is not the best. Yes i could use a super duper stack. But who cares ? It meets my needs in a fast and accessible way. It’s also for this reason that 80% of the web runs in PHP.

When I explained the same thing to James he started to go crazy. Like you and me, James have friends and family. These people frequently ask him for help with their professional and personal websites. Guess what language always comes up on these people’s websites? So James finds himself having to change things in PHP often. And he gets incredible headache from it.





With the advent of WordPress, which literally dominates the Internet, James will play with PHP for a long time. By the way, I’m talking to you as if this language could only handle a blog like mine but that’s obviously not the case. Facebook, Wikipedia, Yahoo, Flickr, Tumblr all these sites run in PHP and welcome millions of users every month without flinching. PHP does this very well and has been doing it for a long time.



The future is now old man

You’ve been hearing for 10 years that PHP is going to die. Yet he’s still here. Despite time and the latest hypothetical technology, it’s not moving. Developers hate PHP because it is the opposite of hype driven development. In a profession where everyone invests quickly on the latest stuff, PHP is an old man who doesn’t want to sell his land. An old man who continues to dance insolently.





My discussion with James continues normally and all of a sudden he tells me something completely shocking. “On top of that PHP is by far the slowest language you can find for web”. When he said that I understood that James didn’t read anything on PHP since a long time.



PHP evolves, not its reputation

In the minds of many developers, PHP has remained in version 4. When the language was unstable, with disastrous performance and non-existent OOP. Developers hate PHP because they believe the language has been stagnating for 20 years. When you know PHP today you know that it’s far from PHP4.

PHP7 is faster than Python and Ruby. The language can be strongly typed if you wish. Tooling is also evolving with static parsers that have appeared in recent years. Frameworks like Symfony or Zend force good practices. A new version is released every year with a very precise agenda. Moreover PHP7.4 is here with even more performance. Once again I won’t list everything that is happening in modern PHP for the sake of length. If you want to know everything I invite you to read this article. It’s time to change your vision on this language that has nothing to do with what it used to be.





Developers hate PHP because it’s cool to hate PHP. This language continues to have a really bad reputation because of it. And yes, there is a strong legacy and a lot of problems. But there is a lot of good stuff too for most of the websites.



Epilogue

Most developers who hate PHP hate it out of elitism or ignorance. Either way it’s dumb. You have to choose a technology based on what you need. PHP is highly useful and powerful in many scenarios. And taking it out of the equation just because of its reputation is not a good idea.

Written by

jesuisundev
I'm a dev. Right now i'm Backend Developer / DevOps in Montreal. Dev is one of my passions and I write as I speak. I talk to you daily on my Twitter. You can insult me at this e-mail or do it directly in the comments below. There's even a newsletter !

81 thoughts on “Why developers hate PHP”

  1. My favorite thing about php is the people dissing on it, who then turn around and extol the virtues of JavaScript, completely unironically. I must simply roll my eyes.

    1. Seriously. I used to hate it until I really learned it. Getting into it was confusing for me when I started out since I conflated WordPress with php and there is an overwhelming amount of bad information pushed to the top by SEO nerds. A few years down the line I absolutely love it. Now these days I see sites everywhere using overcomplicated javascript trying to do things that would take a simple line or two in PHP to accomplish.

      1. Zach your comment on “overcomplicated javascript” is not valid. PHP is server side and javascript is client side. You don’t want to send requests to the server when it can be handled by the client. “overcomplicated javascript that can be handle in a few lines of PHP” simply means the author doesn’t have a good knowledge of javascript. You got it right with respect to WordPress, a product put together by want-to-be coders. Sending requests back to the server is exactly the kind of thing you will see in WordPress.

    1. PHP is my first love and has never broke my heart since I was 12.

      I want a language to break my heart and Php seem to not be ready to do so. I hate Php for this in a good way.

  2. Great content. I’m working with PHP by the last 19 years with no regret. It’s a powerful ecosystem and you touched many points. Most of them not just for PHP. It’s a text for PHP and other languages’ developers and enthusiasts should read.

    Thanks for your content

  3. All of the above is true.
    Yet almost every bad thing (and much more) that’s often said about PHP is actually correct when said about WordPress.
    So, if you need an outlet for your hate, direct it towards WP instead, and you’ll likely be justified.

    1. Completely agree. I feel most of my hatred for anything web related is due to the horrific code I’ve seen on WordPress, mostly core WordPress as well. The standards, conventions and inconsistency on that system is horrendous. It genuinely baffles me how that CMS doesn’t collapse in on itself!

      Don’t even get me started on WooCommerce either!

      1. If you wanna what’s the latest PHP standard and practices, take a look at the Laravel framework. I think this is the framework and Symphony also that saved PHP.

      2. You nailed it IO and Joe with respect to WordPress. I stopped recommending WordPress 15 years ago due to the products, lets call it poor management of the coding. And the phrase “WordPress Developer” is of course an Oxymoron.

  4. Surprised there was no mention of Laravel on this. For years, I never really had an opinion on PHP, I used it, I had times where it was easy and others when it wasn’t.

    After taking a couple years off from development and coming back and finding Laravel I actually started to enjoy programming in PHP again, it actually gave me an opinion on it and it was positive. It’s whole ecosystem is very impressive.

  5. “Developers hate PHP because it’s cool to hate PHP.”

    On point.

    PHP, as you said, has a lot of bad stuff. A lot. But people who hate it are often only looking at the tech side of things. If you include the business side of it, or even the easy of use for final users, PHP and WP allow you to get started online with almost no financial investment.

    There’s a reason why WP hasn’t had a big rival in years..

  6. Currently using PHP on one of the top 50 websites in the world by traffic. The language has surprised me by failing to live up to its bad reputation – not only is it fast and flexible, but it is also object-oriented. Composer package manager allows you to easily add new libraries to your project, while a good framework like Symfony with Doctrine ORM or Laravel with Eloquent ORM allows you to build robust code that adheres to proper standards at a much faster development speed than many other languages. While it is true that PHP legacy code can be very painful to work with if it was constructed by amateur developers, the language is increasingly fixing a lot of those issues (as of PHP 7.4 you can declare types at the variable level and in an earlier version of PHP 7 they added type hints to function parameters and function returns). Overall, when I started working on this project I didn’t have a good opinion of PHP, but I now find I am surprised that it is one of my favorite development languages, and I will likely use it in most web projects going forward.

  7. I love PHP but am finding it difficult to understand PHP 7+ . Worst of it all I don’t understand the documentation from the PHP official site. Any suggestion to a site, book or YouTube channel would be received with thanks.

  8. well, you are absolutely right And yet …
    As a developer I do dislike a badly designed language because you will hit a lot of codebases in which you will be forced to adapt to those bad practices and waste your time in impossible debugging loops. You can get that in a lot of languages (chiefly Js/node) but none comes close to php, even 7. Of course there is also the issue that the best php 7 has to offer came in php 7.1 and later whereas a significant amount of applications run older versions.
    Of course, there is also the matter of cheap exaggerations. Sure, wikipedia runs mostly on php but face book and yahoo don’t. Yeah, they use it in some aspects but they’re not your grandpa’s symfony 100% MVC.
    And speed … yeah, the interpreter in CLI can do basic math better than python. Or Ruby. On the other hand, node, rust, go, even Java in a web context … not a chance.
    Bottom line is, php is badly designed.i don’t care about why, the result is the same. If you want to significantly grow as a developer, you need better than the inconsistencies of the standard php api or spending more time configuring tools to enforce good design than actually designing.

  9. I am a PHP web developer . if anyone hate php it is because of their lack of experience and low knowledge of its applications. Php still remains the most powerful web development language.

  10. I cut my programming teeth on PHP, so I still like it. I’ve long wondered why there was so much hate for PHP, and this article helped me answer that question.
    Caveat: the lack of typing in PHP is one of my favorite parts. I had to do some C# / ASP programming years ago, and the endless re-casting of variables from poorly coded libraries and still getting errors upon errors upon errors made me want to die.

  11. I hate PHP because every time I sit down to work with it, I end up miserable. I hate the inconsistencies in name and syntax so much. I hate that instead of just fixing mysql_escape_string they added mysql_real_escape_string. Any sensible person would just fix the problem and add a warning in the release notes, not leave the broken version out there for new developers to use. Yes, I understand that is gone as of PHP 7, but it illustrates the point that the language is a mess.

    I’d much rather use something with more structure and better standards. Driving cross country through cornfields instead of on roads may offer you more “freedom” but it doesn’t make it a nicer ride.

    1. This is why both mysql_escape_string and mysql_real_escape_string have been deprecated for years now. You are actually emphasizing the point the article is trying to make. PHP is 25 years old, and back in the days people had different standards which you cannot compare to today’s world and latest PHP versions. It’s silly to use arguments that date back +10 years and judge modern PHP for it.

  12. PHP was not “designed” intentionally – excellent article. All really experienced get-stuff-done developers love PHP. JS should stay as simple front-end glue. I know so many hot-shots who disagree – makes me chuckle.

  13. I wouldn’t touch Laravel again with a long pole though – unless you paid me a lot of money. Laravel lovers make me chuckle too. Not as mich as React devs though.

  14. Love Vue? Yes you – please try Vanilla JS or reef.js – your customers, future maintainers and those on 3G will thank you.

  15. Copycats brought code in PHP and that made it bad looking. Frameworks such as Symfony, Zend were kind of java, disgusting.
    Laravel slowly discovered that focus on consistent development model is the thing instead of focus on framework.
    An example.
    PHP in HTML is beautiful.
    What do framework developers? they implement twig. They have no clue, they simply do not know how to build the right architecture.

  16. I love how you get soooooo very close, but then the fanaticism comes out and you completely miss the point. People hate PHP because its syntax is terrible, it refuses to adapt to changes in the way programming is done, and yes, it was terribly and inconsistently designed from the very beginning.

    Now that being said, even the crappiest tools can be used to make nice software. Laravel is proof that even PHP can shine when used in a modern way, but developers still hate it because you have to actively fight against the language, the built in functions, and the terrible ecosystem in order to get anything done.

  17. When devs are bad in OOP… Maybe you means “PHP scripting” and not “PHP programming” , it doesn’t metter the used programming language as much as the pattern design and Object concept, And how to do more with less code for the best memory usage and response time, I dont think PHP Haters can made a better one! A built from scratch! … Even a tiny programming language that works perfectly, i hope only that results will be ok with other one or they will become Java haters as well

  18. I never knew it was hated so much. I’ve loved it since i was in university. I think the hate comes from people who don’t understand it. The same people struggle with javascript frameworks too so you know maybe its the person

  19. I’ve switched from .NET to PHP7 5 years ago and in terms of web development I wouldn’t go back due to its lightness and speed.
    Bashing PHP has become more of a meme than the language actually having issues and people only replicate without knowing it throughly.

  20. I love PHP build mp3tager.com on laravel 7.0 and naijacrawl.com on laravel 5.8 which is based on api, where mp3tager feeds from

  21. I was a resident of a country where .Net is the only language there, at that time all I knew about PHP that it is a junk, many years later I moved to a new country where they only use PHP, I used all tutorials to quickly learn it in order to find a job, it was PHP 7 and in two months I was able to make my first web app with php, now I feel I forgot all about .Net

  22. Honestly I love those haters of PHP, it makes the programming world more lively, PHP gives me headache but it’s still AWESOME, I LOVE PHP

  23. I am involved in php development since from 10 years. and I love php, it never heart me. And surprice that there is no discussion of Yii2 framework which make it more strong.

  24. The epilogue applies exactly to Perl 5 which got the same reputation. Perl 6 (now named Raku) is a completely modern language that doesn’t get traction just because of the name “Perl”.

  25. The worst code I’ve seen was always written in PHP. Switch with 25 cases I saw 6 years ago, functions with 11 parameters used in the code logic of pricing I saw just last summer. This logic was so bad, it took me months and I was unable to fix it because of side effects and breaking elsewhere. I have bad memories from it, to the level of twisting my stomach when I think about it. The language evolved but many projects didn’t. I am here to say I hate it from experience, legacy projects are always PHP and I worked with boilerplate Java, Python and now Nodejs and learning Elixir right now.
    This situation with PHP arose from the language not having a standard for years (PHP-FIG), tutorials that were teaching hacky solutions and that the first framework Zend wasn’t used because no one wanted to pay for it for some reason. Also yes, now for my personal opinion I don’t miss having to type $this-> on 90% of my lines and wonder which of the 11 functions to print a string to use that are still present to this day. The language is still plagued by having 2 tools to install extensions, it’s still so painful to install you use Docker or a VM to just work with it (laravel).

    Before someone hits me for writing Javascript/Node, Typescript is becoming a standard fast and the amount of tool usage is meant to reduce: https://www.swyx.io/writing/js-third-age/ .

  26. Nice article. Thanks for telling arguments of both opinions.
    I was a Java developer that wanted to move to web developer. I’ve worked with Javascript and PHP since the beginning. You can do terrible things with them, but also with pretty much everything. I used Symfony, CakePHP, Code Igniter, PhalconPHP, Yii2 and my favorite one is Lumen and its parent Laravel.
    I’ve also lately used other languages and frameworks, like Java-Spring Boot, Node.js-Express, Python-FastAPI, and my favorite one is still PHP.
    There’s no productivity like the one provided by Laravel in PHP. Express, FastAPI, Spring Boot… everything seems so unproductive compared to a PHP framework.
    PHP7 was a big step forward.

  27. There are no bad languages, only bad coders. I’ve designed, coded, and managed devos for 40 years. Developers usually prefer the language they are most proficient in, but a skilled coder will figure out how to write good code in anything. Languages that are inconsistent and poorly designed get better as skilled coders grow good practices and suggest improvements. Languages get passed up by others that are evolving faster and address current requirements more easily and eventually fall into disuse. I haven’t heard of any new FORTRAN or FORTH code lately, but the languages themselves are fine. PHP is typical.

  28. My issue with PHP is that it doesn’t bring anything new to the table. If PHP were to be released today, noone would use it.
    If i need Performance, i will write my server in C++, Rust or Java. If i need easy concurrency, i will use Go. If i need one language for the front-end and back-end, i will go for JavaScript/Typescript/NodeJs/Deno.
    This blog can be written in PHP with any problem because it is very basic. Huge application, in which speed and concurrency is required overrun what PHP can do. Moreover i hate the $-syntax.

    1. Is the New York Times a simple blog? What about tech crunch? How about the New York post? Your argument makes no sense. All of these huge sites who have millions of visitors a day not only run on php but run on WordPress.

  29. Marv is exactly correct. Essentially bad programmers whine about their own deficiencies.

    Were PHP released today it’d be hyped as the new easy to code kid on the block and everyone would use it. However that is not the case and in fact many of the newer language probably would not exist at all were it not for PHP.

    PHP7.4 is highly performant and actually a joy to work with. Everything old is new…

  30. I hate PHP because my cloud hosted .Net stack is constantly hit with attacks designed to exploit so many well known PHP fails that I’m spending time coding ways to drop such spam so that my servers can handle actual traffic.

    Pointing at big names and saying “it’s not all bad, these guys use it” is hilarious when half of the same community when faced with “windows aint all bad all these guys use it ” react completely the opposite way.

    – WordPress is a blight that needs to be torn down due bad bloated output, poor performance and excessive security holes.
    – Facebook is full of bugs and consistency issues, doesn’t run “PHP” instead uses some abomination that is based on it but essentially a complete rebuild.
    – Wikipedia is mostly static content and basically doesn’t require a server side framework at all.
    – Yahoo is a dead search engine repeatedly mired by bad leadership decisions.
    – Flickr & Tumblr do most of the smart work in javascript in the browser and still heavily rely on excessive compression to get any level of decent performance.

    I’ve actually tested the performance claims.
    “un-cached” PHP has the issue of having to JIT compile the page on a request by request basis, the framework and compiler have made steps to offset that by caching compilations but the fact is it’ll never perform like a compiled language no matter how you spin it.
    Comparatively speaking, a simple request that hits a database at least once usually takes about 10 times as long on PHP as it does with .Net Core.
    You can offset this by deploying more servers so that at scale you achieve “similar” performance levels but why should we all run 10 servers to do the work of 1?

    As the Linux community loves to point out to Windows users …
    Just because something is used a lot, doesn’t make it good, usually bad products hang around because there’s something about them that’s unique, easy, or just plain convenient for its consumers.

    In Windows (for example), the decades long backwards compatibility has had a major impact on it’s last-ability. For PHP I think this falls on its open-ness, PHP devs don’t like to be told “follow this pattern”, having that freedom to basically use a language and build your own rules has a certain appeal, and new devs are easily sold by big names being thrown out like they mean something.

    I still can’t see why flickrs homepage (for example) requires 110 individual requests for so little content on the page, the only reasonable explanation I can see for this is bad design built on top of a bad API.

    So leaves me with one final conclusion ….
    The reason PHP is so popular is that 199 out of 200 programmers can’t program (citation: https://blog.codinghorror.com/why-cant-programmers-program/), PHP has a lot of tools built to make programmers life a bit easier.
    Instead of teaching programmers good programming practices it teaches them to use tools to generate most of the result and I’ve seen a ton of CV’s recently (as i’m in the process of recruiting new web developers that have statements like “developed a site in wordpress” … sorry but using wordpress tooling is not development!

Leave a reply

Your email address will not be published. Required fields are marked *