DEV Community

Cover image for What’s Wrong With PHP? Why Developers Hate It

What’s Wrong With PHP? Why Developers Hate It

Muhammad Usman on February 18, 2025

PHP has been hated for decades, and whether it deserves it or not. What’s going on, guys? In this article, we’re going to talk about PHP and wheth...
Collapse
 
dev-ux-lesezeichen profile image
DevUx Bookmark

Nice post, but maybe you should rather bash JavaScript, which is worse in many regards Even if we write TypeScript, we must deploy code in an unsafe legacy language. Backend developers have a choice at least, not only between languages, but also to write clean code if the language supports it, and PHP 8 does. And PHP 7 did as well.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

unsafe legacy language

JavaScript isn't any less safe than TypeScript. They're the same language, one just has some extra annotations so you can run your code through a type checker and get some extra tests to catch possible mistake.

The situation where the browsers are restricted to one language and it needs to remain backwards compatible is annoying, yes. But JavaScript does a relatively decent job at being the best possible language within those constraints.

PHP does not have that excuse. It's just mediocre because it wants to.

Collapse
 
dev-ux-lesezeichen profile image
DevUx Bookmark

JavaScript isn't any less safe than TypeScript

because TypeScript is compiled to JavaScript, so we could argue it's just a better JSDoc linter?

Collapse
 
ayesha_03 profile image
Ayesha Tariq

Yes, you are right!

Collapse
 
web_dev-usman profile image
Muhammad Usman

I have shown the pretty good side of PHP as myself am a WordPress Developer.
Thanks for reading!

Collapse
 
web_dev-usman profile image
Muhammad Usman

I just wanted to send this message to the community that, why developers hate PHP because it is still a language, and didn't deserve the hate. Billy and Bob is just a story on hate on PHP, other than that you can see I did not bash, instead I presented a pretty good side of PHP and it didn't deserve hate.
Hope you all understand.

Collapse
 
panditapan profile image
Pandita

Hi Muhammad, developers here in dev.to are uh... very passionate about about PHP. When I saw your post yesterday I was like "oh no! he opened the Pandora box, maybe it'll be different this time 😰", unfortunately it wasn't. There are some thoughtful comments and others not so much, you don't have to engage right now (or ever) with any of them.

But you're right! Your post doesn't deserve hate but it did garner a lot of attention! I suggest taking this as a learning opportunity (or take it as a blog milestone! 😂), enjoy the engagement and I hope this doesn't stop you from posting here ✨

Good luck!!

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

I also think that a lot of PHP hate comes from the code inexperienced people produce, and I think I even mentioned that in some other comment a few months ago.

But there's also many reasons to dislike the language itself. The classic "Unexpected T_PAAMAYIM_NEKUDOTAYIM" is a great example. phpsadness.com lists plenty more examples of very questionable design choices that make the language hard to like.

Blaming it entirely on bad code from inexperienced devs is still missing part of the picture.

Collapse
 
xwero profile image
david duymelinck • Edited

The reason you have to write this comment shows that there is something wrong with the content of your post.

In my second comment I wanted to show you some examples. I shouldn't have written the first comment because it was a just a remark about Wordpress that had nothing to do with the post.

Collapse
 
leob profile image
leob • Edited

What's wrong with PHP? Nothing :-) but maybe there's something wrong with the way it's often being used ...

People who use a framework like Laravel don't hate PHP, they love it! Especially newer versions (PHP 8), which have added a lot of performance, and some cool features ...

Yes, if you see WordPress code it tends to be "stone age" and terrible, but there's a lot of love for Laravel, and I think that has also made people reconsider their views of PHP.

In other words - any programming language can be used in a cool way, or in a terrible way ;-)

Collapse
 
fred_morgan_efe59fcc7dca9 profile image
Fred Morgan

Just a quick comment, 40 pages of code is nothing. If a senior developer can't understand 40 pages of code by an intern, something is wrong with the senior developer.

Using AI tools to document is pretty amazing, and it will be accurate. Unlike comments which often say what you think the code does and rarely are kept up to date.

Perhaps the moral to the story is senior developers who can't read and modify other people's code.

Yes,PHP can let you write awful code. And English can let you write comments that aren't worth reading. :) With great flexibility comes more responsiblty, perhaps having an intern write your inventory system without oversight is a bad idea...

Seriously, first versions, especially when so small, are often scrapped. There is no reason not to use it as a prototype and do something better since it was useful.

Collapse
 
fire_punch_1 profile image
Darth Bateman

Can't or won't?

If I have a function that leads to another function that leads to another function and I have a stack of 40 functions each with 1 different input and output, I COULD figure out what these do given time.

But the question rises : "WHY THE HELL WOULD I DO THAT?!"

Collapse
 
beep_c4ba7de453757 profile image
Amit Barzel

so that your function isn't one giant function that illegible? same reason we break create functions for basic tasks and not make it an eye source for any new readers

Thread Thread
 
fire_punch_1 profile image
Darth Bateman • Edited

My question is pending, you big meanie.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Being able to read code doesn't mean you won't hate it.

I've had to work through some truly horrific code, and it's not enjoyable at all. You find yourself looking at a line, thinking it doesn't do anything at all, but double-guessing yourself because "it has to be there for a reason, right?" Then you remove it the program still runs.

This is slow, unenjoyable and you spend the entire time remembering all the other stuff you could be doing instead if only this code was at least somewhat decent.

An hour later, you're done with a task that could have taken 10 minutes and probably refactored some of the code while you had the file open, on top of feeding it through a linter to make it readable in the first place.

What you're left with is frustration. You feel like your time was wasted.

Collapse
 
beep_c4ba7de453757 profile image
Amit Barzel • Edited

frankly, i've read some very beautifully thought out php code before. php works out the gate, which makes most people not work on improving the code since it works on their first merry go round. as for commenting, php lets you move quickly and without much friction so i find most people just choose to keep writing the next line of code instead of stopping to add a comment. when i write in c, it's a lot slower and i leave comments between pauses of thought.

Collapse
 
xwero profile image
david duymelinck

Maybe you should look at Wordpress before you judge the language.

With PHP, there is no framework to learn. Now, I know there are many PHP frameworks, and yes, you can use one. Because you don’t have to. It just works without it.

Any code in any language can work without a framework. It are the developers at Wordpress who choose not to use a framework. The problem Is they also choose to support a language version that is unsupported for over two years now.
And that is why you are missing out on great features.

php.net/releases/8.0/en.php
php.net/releases/8.1/en.php
php.net/releases/8.2/en.php
php.net/releases/8.3/en.php
php.net/releases/8.4/en.php

Billy in your story is Wordpress. And Bob does not blame the language , but Billy.

Collapse
 
web_dev-usman profile image
Muhammad Usman

Thanks for your opinion, much appreciated.

Collapse
 
xwero profile image
david duymelinck • Edited

It is not an opinion. I get it from the tone in your post.

The fact of the matter is PHP is incredibly easy to use, and it’s very quick to use. There’s nothing to install, there’s nothing to configure.

This shows me you never have touched a php.ini file or installed extensions.

So that makes it incredibly easy to get up and running very quickly for small startups, individuals, people with not a lot of experience or coding skills.

Any language can be picked up by people with no experience. But you still need to know how to set up a webserver if you are going to create a website.

Does PHP suck? Bob thinks so. And all the other real programmers out there think so.

You don't consider yourself to be a real programmer? You are a Wordpress developer.

There is no doubt Python is a better programming language. Ruby is better. Even JavaScript is probably better. But PHP is still decent.

That is not really a glowing recommendation for PHP. It is more a look I fixed a leak with duct tape vibe.

Thread Thread
 
web_dev-usman profile image
Muhammad Usman

Sure, thanks for the duct tape.

Collapse
 
badseller profile image
Oleksandr

People think that PHP is bad because they don't understand that language is not the problem of their sucks projects and architecture

Collapse
 
elanatframework profile image
Elanat Framework

Thank you, I read your article to the end.

This title is better for your article: "Why we need to use PHP frameworks"

Of course, I must say that you can still write good programs in PHP without using a framework.

If you put some talent and creativity:

  • You can add layout and call it in PHP pages.
  • You can separate HTML from PHP codes.
  • Create proper configuration and correct layout for scripts.
  • Create documentation for the program structure.

At Elanat, we are trying to make WebForms Core technology available for all programming languages.
Installing tools for many programming languages ​​was complicated and difficult, but for PHP we just installed EasyPHP.

WebForms.php Update to WebFormsJS 1.6

Collapse
 
pinotattari profile image
Riccardo Bernardini

Sorry, but I think that PHP has several intrinsic defects and Billy is not to be blamed for them. Sure a tool, like a knife, but a tool can be a bad tool, like a rusty knife.

Some of the issues I find in PHP

  • An incoherent API that forces me every time to check the manual (in implode the separator is the first or the second argument?)
  • I just discovered that implode exchanged the order of arguments in PHP 8.0.0. That's sadism ;-) I do not want imagine the mess in using an old code with the new version...
  • No static typing. Sure, convenient for small scale stuff, but a fairly serious issue IMHO if you want to write large and complex software. Static typing saves you lot of headaches and stupid errors. However, PHP shares this defect with many other languages (JS, Ruby, Python, ...). In Ruby I got the habit of putting a "guard" at the beginning of every function to check that the types are correct.
  • It converts everything in everything else. This is maybe the most serious defect (shared with JS and PERL, if I remember correctly). When a language has the triple equality operator === it is a bad sign: it usually means that the language converts everything and the equality is not transitive (Ruby is an exception to this since Ruby is is not an "hard core converter" and gives to === a different meaning).
  • In a boolean context the integer 0, the empty string "", the string with zero "0", float zero 0.0, an empty array and NULL are considered false. No, sorry, when you get a string or a float when you expect a boolean, you must raise an error, not hammer the value into a boolean. Sure, you can === with false, but you wouldn't need this hack if PHP did not try to convert whatever you hand it to a boolean.

Those defects are not fatal, mind you, you can still write very large and complex software and you can have a smoothly working code if you are careful. The problem is that if is a big if: programmers are human being and they can be tired, worried, sick and make mistakes. A good language is a language that protects you from silly errors that you'll inevitably do, even if you are a seasoned professional.

Languages like JS and PHP give you lots of freedom, no need to declare variables, no need to worry about the type of your data, ... but this freedom makes it easier for error to sneak into the code.

Personally, give me a static and strongly typed language, possibly with contracts, a language that can act as a pair programming partner.

Collapse
 
xwero profile image
david duymelinck

True, PHP has issues. But the language improves with each new version.
Php 8.0 has a saner number comparison.
Type hinting is in my opinion on par with strongly typed languages.

Sure you still can do all that bad stuff, but if you add a static analyser, like phpstan, to your development flow you will be yelled at.
You can make the checks as strict as you want and even create your own. I think that is better than a compiler.

Collapse
 
beep_c4ba7de453757 profile image
Amit Barzel • Edited

and in asm the destination and source can swap places depending on what syntax you use as well as what version of it you use, so would you call that a bad language?

Collapse
 
itsmestevieg profile image
Stevie G

I respectfully disagree with your assessment of PHP. The language has significantly improved with versions 7 and 8, introducing strict typing for enhanced code reliability. Its flexibility allows efficient coding, and performance has been boosted by the Just-In-Time (JIT) compiler in PHP 8. As of 2024, PHP powers over 75% of websites, highlighting its robustness in web development.

The PHP Framework Interoperability Group (PHP-FIG) has established standards, known as PHP Standard Recommendations (PSRs), to promote consistency and interoperability among PHP projects. These standards cover various aspects of PHP development, including autoloading (PSR-4), coding style (PSR-12), and common interfaces for logging (PSR-3) and caching (PSR-6). Adopting these standards fosters a unified and professional PHP ecosystem, enabling developers to create maintainable and robust applications.

Additionally, the PHP community benefits from Packagist, the default package repository for Composer, PHP's dependency manager. Packagist aggregates public PHP packages, simplifying the discovery and integration of libraries into projects. This extensive repository streamlines package management and encourages code reuse, enhancing PHP's efficiency and appeal in the development community. With tools like Composer and Packagist, developers can rapidly spin up applications by easily managing and incorporating dependencies, thereby accelerating the development process.

Furthermore, PHP-FIG standards, such as PSR-12, provide a comprehensive coding style guide that ensures code is neat and consistent across different projects. By adhering to these guidelines, developers reduce cognitive friction when collaborating, as the codebase follows a uniform structure and style. This uniformity not only makes the code more readable but also simplifies maintenance and reduces the likelihood of errors. The emphasis on consistent indentation, spacing, and naming conventions contributes to a cleaner and more professional codebase, facilitating better teamwork and code quality.

Collapse
 
xwero profile image
david duymelinck

While I agree with most of your comment.
Sadly the biggest part of 75% of the websites are Wordpress sites. Which is not the best student in the class.
So the likelihood that people are going to see that code is bigger than they are going to see standards driven projects.

Collapse
 
damian_cyrus profile image
Damian Cyrus

No PHP blaming from my side. It is a tool, and how you use it.

For the story, I would turn the table: the one to blame in this case it's the company. It let the intern do whatever he wanted, and as he got something they let him do whatever he wanted without a Bob mentor. Bob on the other side spend too much time with this environment, so he would never blame that environment first without understanding its circumstances.

All in all, Bob should be thankful to the young developer. Now he has a strong argument to refactor the code or bring in a new tool, as the old one doesn't fit the requirements anymore. Win-Win situation for everyone.

Try to find the jokes here. 😁

Collapse
 
skamansam profile image
Samuel

I loved PHP before v5. Before they added all the OOP-like stuff. Back when it was essentially perl macros. I loved perl, too. Inho, symfony ruined pho cuz everyone uses it now and it's just overkill for 90% of the projects that use it.

Collapse
 
xwero profile image
david duymelinck

Oh yes the times when includes where plentiful, and it was nothing more than a way to avoid writing C.
It would be a nightmare to create solutions that others could use and expand.

Even a language like Go, that has simplicity as a core value, has OOP-like features like structs and inferfaces.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

That’s opposed to every other web framework like

First mistake: You're comparing a language (PHP) to a series of frameworks. For any serious PHP development, you'll need a framework as well, so this entire point just falls apart. Most other languages have some kind of web-server as well; or they could even interface with a server via CGI. For a small website that's looking at requests per hour rather than per second, this is perfectly fine.

There is no doubt Python is a better programming language. Ruby is better. Even JavaScript is probably better. But PHP is still decent. If you’ve got an idea and want to crank something out with PHP over a weekend, you can.

I think you've hit the nail on the head, but what you're missing is that there's no reason for anyone to use a decent tool when they could use a really good tool.

PHP would never have been used if it was utter garbage; but the reason everyone hates it is that it just has too many flaws. The syntax is unwieldy, the naming of the standard library is a nightmare, performance is quite bad, and the language just overall shows that it started out as glorified string interpolation and grew from there.

Collapse
 
robin-ivi profile image
Robin 🎭

PHP is widely used but often criticized for its inconsistent syntax, weak typing, and security flaws. While it’s easy to learn and has strong community support, its design feels outdated and messy. Performance has improved, but many developers prefer modern alternatives like Python or Node.js for scalability and maintainability.

Collapse
 
xwero profile image
david duymelinck

Most languages have security flaws in some of their versions, for example Python. It is not a PHP only problem.
Python is older than PHP.

Python and javascript are both weak typed languages.

What is the last time you used PHP?

Collapse
 
robin-ivi profile image
Robin 🎭

You're absolutely right—security flaws exist in most programming languages, including Python and JavaScript, not just PHP. Security issues often arise due to improper implementation rather than the language itself.

Python, which was first released in 1991, is indeed older than PHP, which was introduced in 1995. Both Python and JavaScript are weakly typed, meaning they allow implicit type conversions, which can sometimes lead to unintended behavior.

As for PHP, I work with it frequently, especially when helping developers with Laravel projects, WordPress development, and backend solutions.

Collapse
 
adam_wodon_deabae31a2168f profile image
Adam Wodon

You don't know what you're talking about. Just so you know.

Collapse
 
straight_busta_5d08ab9682 profile image
Straight Busta

People who hate PHP are frontend noobs who learned programming by drag n drops.

Collapse
 
mdchaney profile image
Michael Chaney

I'm an RoR dev who used PHP up until 20 years ago. I discovered one of the very major bugs early in PHP 4.0 dealing with session fixation.

PHP 1-4 was awful. This guy sums it up nicely:

eev.ee/blog/2012/04/09/php-a-fract...

Back in the day, there was a global namespace, everything lived there, I could go on. I don't need to.

Obviously, the language has gotten much better over the last few years as it's attracted better talent into the task of bringing it up to modern standards. But it offers nothing over the alternatives. I think Laravel is probably moving it forward more than anything else, and that's a good thing. It's good to have a lot of alternatives for web development.

Collapse
 
ec_jep_04a6ea85098c5e645a profile image
Ec Jep

Hi, I don't think people hate php, it's just not cool anymore.
I am a php developer for the last 25 years.
People Do not now how powerful Php is.
Find me a language that you can run both C & Lua in the same script.

Php doesn't have a sponsor like Java or C#.
Until 10 years ago, before microsoft took over on python, it was geeks language.

Collapse
 
davidmarccram profile image
davidmarccram

So PHP isn't actually bad...it's just worse than everything else? :-)

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Maybe not everything else, but just most of the popular alternatives.

I'd rather build a website in PHP than in C.

But I wouldn't pick it over Ruby, Lua, JavaScript, maybe even Python, etc.

Collapse
 
keyru_nasirusman profile image
keyru Nasir Usman • Edited

I am sure if there hadn't been a framework called Laravel, you guys wouldn't have used PHP. Hadn't it been for Wordpress, PHP would have been dead by now. I don't why you guys try to convince us that PHP is a good programming lang. No! PHP sucks. Even the creator of PHP has clearly said "I don’t know how to stop it; there was never any intent to write a programming language." But this doesn't mean PHP is useless. PHP is a tool and gets the job done just like any other language.

Collapse
 
noxyucm profile image
Trumps Ear

Why are you so easily state that developers/everybody hate/s PHP??

What is your statement based upon? 🤔 Making such subjective conclusions are wrong.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Because it's true. Everyone hates PHP.

Making such subjective conclusions are wrong.

It's an objective observation.

Collapse
 
vsevolod_ukrainsky_5ae4ea profile image
Vsevolod Ukrainsky

Oh, really?

I love PHP and use it in 90% of my projects, so when you say that "everyone hates it", you are wrong.

You seem to be confusing objective and subjective statements - but don't worry, you'll learn the difference in school next year.

Collapse
 
nasoma profile image
nasoma

PHP is so old. I love "Modern" web app development. Unlike PHP, "Modern" web development with "modern" tools is so easy. If in doubt, just see below:

Authentication = $30 per month.
File uploads = $10 per month.
Logs and monitoring = $10 per month.
Image hosting = $5 per month.
Database hosting = $25 per month.
Email sending = $15 per month.
Form handling = $5 per month.
Search functionality = $10 per month.
Hosting = $25 per month.

Just a mere $135 per month before you have a functional app. You will have to be mad not to see how modern this is. I would rather use a VC backed authentication system that use one that comes in the box like in the case of Laravel. Its 2025, we have a duty to support VCs.

Collapse
 
frangonzalez profile image
Francisco Gonzalez

Having worked with PHP and a handful of its frameworks for over 10 years, alongside other languages, I can say with some authority to those using this stack:

Drop PHP while you can.

Yes, PHP has had a massive presence on the Web, but it has been stigmatized for years as a 'second-class' language. Why? I'll outline the reasons:

The Legacy of Ease and Chaos:

PHP's accessibility was its greatest appeal, but also its downfall. Anyone could start, leading to a sea of low-quality code, like the infamous 'Billy's code.' This lack of entry barriers has created an ecosystem with a vast disparity in developer quality to this day.

The Absence of Standards and Certifications:

Unlike other languages, PHP lacks solid or globally recognized certification standards. (Yes, there are Zend certifications, but in these 10 years, I think I've met 1 person who bothered to get certified in PHP and use the Zend framework). Well, this means that companies often hire developers without guarantees of competence, perpetuating the cycle of poor code and 'technical debt.'

The Responsibility of Companies:

Companies that continue to use PHP have a responsibility to demand a higher level of professionalism, but they don't, nothing out of the ordinary. They should invest in training their teams, adopt good development practices, and seriously consider migrating to more modern technologies, but they stick with what they have because 'it works' and the professional market is 'cheap.'

The 'Bob Effect' and the Frustration of Professionals:

The character of 'Bob' represents the frustration of many experienced developers who have to deal with legacy PHP code, and I've seen all sorts of things in recent years. This frustration is understandable and valid. PHP, as a tool, is not the problem, but its widespread use without standards has created a toxic environment, and little can be done if developers do not become aware of the need to certify knowledge and commit to deepening their understanding of the language/framework and using good development practices.

I'm not saying PHP has no value. For small and quick projects, it may be enough. But for enterprise applications and long-term projects, PHP is being viewed very poorly, especially by veterans in the industry, who have barely looked at the evolution of this language, only to adopt what is in vogue. This means that your options in the search for job opportunities will be truncated, and if you do find a job, don't expect great professional growth unless you are committed to strongly certifying your knowledge.

What I've said may apply to any technology, but PHP is the most affected by the lack of professionalism and the lack of standards in the industry.

Let's invest in our training, adopt modern technologies, and demand a higher level of professionalism. If you like PHP, get certified, adopt good development practices, but if you don't like it, look for other technologies that make sense to you and offer better growth opportunities.

Collapse
 
adam_wodon_deabae31a2168f profile image
Adam Wodon

All of that has changed. Years ago. Get over it.

Collapse
 
wes_grant_ profile image
Wes Grant

Great story! I was in PHP for the first 12 years of my career. I eventually learned to embrace the frameworks that were available to help tame the Wild Wild West nature of PHP. What I will always miss was the fact that I could build a working solution in less than ten lines of code that would take me hundreds to do now in Java. (Tens of thousands if I write unit tests) ((just kidding but not really))

Collapse
 
berend profile image
berend

Wasn't it Stroustrup...: "There are only two kinds of languages: the ones people complain about and the ones nobody uses". I rest his case.

Collapse
 
khairul_shahid_ddbaa4eee1 profile image
Khairul Shahid

I've been daily driving PHP since PHP 3 and MySQL 3. Over the years, I've encountered many situations where PHP was criticized as inferior to other technologies. One particular case stands out—my team was turned down for a project simply because we used PHP. The client had heard that XYZ was better.

Long story short, the first project was awarded to XYZ, but it failed because it didn't meet user requirements. In the end, we won the second project award.

Collapse
 
web_dev-usman profile image
Muhammad Usman

I didn't mean any disrespect of PHP, here is the clear message of the article, that is,
But PHP is just a tool. Like a hammer. If you hit someone over the head with a hammer, you’re an idiot. It’s not the hammer’s fault.

Conclusion: PHP Still Has Its Place Don’t just discount PHP because you heard someone say it sucks. It’s probably Bob. That’s all for this article. I’ll write you the next article. And PHP isn’t that bad.

This is what I really meant for the PHP.

Collapse
 
david_hahn_3da3604f940e3d profile image
David Hahn

This can be said of any language. The largest companies use PHP, I would not be so quick to bash it. Unless you are not a seasoned developer.

Collapse
 
adam_wodon_deabae31a2168f profile image
Adam Wodon

Python is not definitely better. PHP is just as good or better. Try being better informed than this pedestrian article. Author attempts to defend PHP, but instead perpetuates nonsense.

Collapse
 
slobodan4nista profile image
Slobi

If you think about it, besides terrible choice of some signs (based on my taste) PHP was ahead of its time with single-use callable functions, now we call it lambdas.

Collapse
 
dube profile image
Meli

Thank you,you know I did PHP at my college and I am struggling to get a Job because many Companies want people who know Javascript if not Python.So I have taken the trouble to learn JS