I’ve tried lots of different web stuff. Node, Nextjs, React, Svelte, Django, templating engines. I’ve used PHP before too but that was a long time ago.
I want to try it again, just haven’t had a reason to. Why does everybody hate on it though? What is it that makes people think it sucks?
PHP used to be pretty bad in its early days, PHP has come a long way but some people are still stuck in the past.
There are also some platforms that give PHP a bad name, WordPress for example has attracted lots of bad developers to the PHP language. Magento 2 is also one of the reasons PHP has a bad name, it’s hated by many developers for being slow and overengineered.
I also think it’s because it’s blocking <insert_their_favourite_language> becoming an industry standard.
I would like to emphasize the bad developers part, as others have said here, because for the last like 10 years that’s probably the main reason. The core language has evolved enough that’s good.
Another important aspect is to think about why people hate in general. It shows some type of insecurity. You don’t hate something if you are fine with yourself and your life. Especially when you hate with no actual facts.
Early version of PHP (3, 5)
High volume of bad written apps (WordPress)
25 years old language
Those 3 combine in everyone minds to create a model that looks like “ok it’s an old language, vastly used at the beginning of internet, but now totally destroyed by way better language like [insert trending language here]”
But PHP has evolved since 1996, from a template engine to a backend choice, that goes now VERY fast, with good OOP implementation and awesome frameworks (Symfony, Laravel) & tools.
To add a touch of criticism, I’ld say that the fact PHP isn’t shipped with his package manager is a very strong argument for those who dislikes it, downloads it to try again, and sees nothing about libraries. “ok it stills the same ugly language as 20 years before”
I don’t think the problem is PHP itself, but the developers.
It’s really easy to get started with PHP and as a consequence there are many hobbyists (which is great!) who don’t really know what they are doing (no problem there for hobbyists). But many of them work as a “professional” PHP developer creating giant piles of messy code. Architecture and semantics are not important to them, and that’s a big problem.
People hate on it cos they haven’t used it since v5
site:reddit.com inurl:/r/PHP hate
The devs make it look like shit.
If you compare react with php then you would tell that many stupid ideas would not compile in react and it bounds react devs to some frame of solutions, but that’s not the case in php. In php any stupid idea compiles and “works”, but some of these ideas are worthy of firing out the dev (looping sql queries in html rendering template).
Any code can be bad, but php makes it easiest to create the ugliest code ever possible. It’s a honeypot for potato knowledge developers.
Aside of that PHP is just fine tuned language between complexity and what it offers. From corporate bullshit points it is missing a giant oracle (java) or MS (C#) behind it to back up the “seriousness” if the project.
I will probably never pick php for things like twitter clone unless I want to pay more for server resources, but still.
It’s a starting language for new people in IT so a lot of new projects starts in php as it’s the cheapest way for them to grow, and more experienced devs are going to support it in future so they have reasons to bitch about… “Another one project made by intern to evolve into world class architecture miracle, yyyyeeeeaaah”
PHP is like super loose C, and the interpreter lets you get away with an awful lot. There’s a lot of bad php code out there, which “works”, but adds to the php sucks diatribe.
Php is fast, stable, easy to develop with and 100% has a place in a web tech stack for many applications. We got elephants 🤙.
As mentioned PHP was a pretty poor language until quite recently but I don’t think it’s just that the “LOLZ PHP amirite?” stuff is just a bandwagon that people jump on.
People like bandwagons because it means they don’t need to think to jump on one.
What do you call the start of a linked list? What does PHP call it?
I hear people say “PHP must DIE”, to which I always reply “PHP dies after every single request”
It’s the best tool for the job, it’s that simple!
(Whilst also giving you more than enough rope to hang yourself with)
With popularity comes a lot of crap devs on to the scene.
History.
Some programmers like parrots. They just join the bandwagon. “PHP? Baaad!”
Why? Because they think it’s cool to insult some language library. It makes them feel “senior”. 🙂
PHP is not such a great language but hey, there are pros and cons.
i hate nodejs more.
you mean js ?
There were enormous numbers of big and small projects written in PHP for the past few years, and most are no longer active maintain or no much activity. Everyone could simply code and aren’t well verse in security which is so frequently seen within and other communities, it had gained a bad reputation over time just as it still happens now and future.
Businesses gains the most by rely on off-the-shelve software that can run on shared hosting (capped quota) you don’t see much performance improvements. You are still paying more for the same software and living standard is getting more expensive especially COVID19. One of the reason you can hire PHP programmer at an affordable rate but you can actually develop more efficient codebase in another languages when recompile and testing code is almost instantaneously on Apple M1.
Lastly, PHP keep evolving itself are both good and bad that web frameworks and software solutions are often easier to work in a team which can be difficult when you switch to other solutions with different concepts.
PHP’s ‘Arrays’ are still a rich vein to be mined by haters. Error handling in the form of “warnings” and “notices” is still pretty atrocious. Classes are referenced only as strings, which is also still the only way to have a reference to a standard function or method. Autoloaded namespaces are a poor substitute for a module system. Most of the SPL is a dumpster fire. And then there’s every other function in the global namespace.
As many have already said, a lot of historical issues.
But today still, there are problems with normalisation. Simple things like the order of parameters you give (search(needle, haystack) or (haystack,needle); plus a couple of by-now standards that php not yet supports.
Especially the object oriented parts of php lack behind true object oriented languages and do not implement everything.
So it’s not that php can’t do what other languages can do, it’s just not as neat and tidy as some others.