Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

djangokillen's avatar

Is there a specific reason why PHP is hated by so many developers?

Why is there so much hate driven against PHP by developers? I've read a couple of comments now on other sites where people just write about how much they hate PHP. They don't give any specific reason to why they do it, which is quite sad because I'd really like to know. Do some people hate it because others do? I've been programming PHP for a while now and I think that it really gets the job done.

0 likes
14 replies
Alias's avatar

Because they heard from other people it sucks...

PHP does have it's issues yes, I'm not really the best person to answer but it's easy to write horrendous code as it lets you "get away" with it, whereas other languages kinda enforce you to write code "properly".

It's come on in leaps and bounds though in the last few years, namely due to tools like Composer, and frameworks such as Symfony.

Haters are gunna hate unfortunately.

anchour's avatar

You can write bad code in any language. PHP might just let you get away with more. Great code can be, and is being, written in PHP. There's no reason to hate it anymore. The only thing that should be hated on are those who are spreading misinformation or bad practices, etc.

bashy's avatar

Depends what you're comparing it to or using it for :)

uxweb's avatar

Yeah, it really gets the jobe done, as it is, PHP leads you to create messy and mixed code if you don't use a framework like laravel.

I think that as a language for the web it should come with some MVC components out of the box to let write better code at some level.

i960's avatar

A lot of the hate stems from the pre-5.3 days, and in particular PHP 4. A massive amount of garbage spaghetti code was written in those days, and much of it still exists today. There are still so many PHP tutorials that preach bad coding practices. When looking from the outside in, it makes the language itself look like crap. I think the past 3-4 years have nullified just about every negative argument there is against PHP. Despite some of it's quirks, it's a fantastic language that is only getting better. Ignore the haters.

3 likes
bashy's avatar

Also by far the most used server side language

pmall's avatar

I worked a lot with php and i got tired of it. Then I met composer + laravel :)

6 likes
bestmomo's avatar

I've been playing a lot with PHP when it was version 3. I must say it was abashed code. Then I developped many years with C++ and C# and it was another world. Since some years I come back to PHP and I'm agreeably surprised by the progress of this language (better than my english progress ^^).

djangokillen's avatar

Great to hear all your opinions! @pmall Yeah, composer and Laravel really made it better.

ELD's avatar

@djangokillen a big reason why PHP is so hated across the web development world is because the low barrier to entry for writing PHP code allowed access to many people. A lot of these people weren't formally educated so they wrote poor code. As others have said, the pre-PHP 5 days were the worst of it all. Is the low barrier to entry a bad thing? I'd disagree and say it was good in establishing the language's popularity, but the modernization of PHP took far too long.

Even after PHP 5.3+ came out and modernized the language, it's still in rough shape because most shared hosts are still on PHP 5.3 (god forbid) or PHP 5.4. PHP 5.6 brings in a lot of nice new features that further enables you to write good code in PHP.

On top of this, the language has some oddities related to the type system. This is why two equivalence operators exist: == and ===. One compares without casting to identical types while the other does. This leads to many subtle bugs in your code (unless you're hyperaware of issues like this) when your comparison doesn't quite work the way you expect it.

Not only that, but I know some people have a dislike for PHP's built-in libraries. Their interfaces are pretty non-standard. In functions that take needles and haystacks (search-style functions) sometimes the heap is the first argument and sometimes it's the second.

And then we come to projects like Drupal, WordPress, or Joomla that target antiquated versions of PHP and in turn write non-OOP style code. This is a nightmare for people to work in because often times things aren't logically laid out. WordPress is really the single largest PHP application that's used and because it's code is still fairly antiquated in its architectural style, it puts a bad taste in people's mouths.

2 likes
rapliandras's avatar

PHP has huge inconsistencies, lacks all conventions in parameter orders and function naming.

htmlentities() VS html_entity_decode()

implode(array('a','b','c'), ',') VS explode(',','a,b,c')

and so on

PHP has only taken an acceptable OOP approach in the last like 2 years.

There are also many issues related to dynamic variable typing.

There were and still are completely unneccessary language elements, such as $ or array() till PHP 5.3

In my harsh opinion, PHP sucks. I would be typing on Ruby on Rails forums now if I hadn't found Laravel, which takes the PHP struggle out and puts coding with ease into the development process.

2 likes

Please or to participate in this conversation.