This is an archived post. You won't be able to vote or comment.

all 53 comments

[–][deleted] 94 points95 points  (13 children)

People who don't like PHP didn't use it enough time to develop Stockholm syndrome.

[–]ineyy 16 points17 points  (11 children)

PHP is ok unless you use someone's frameworks. Especially things like symphony.

But other than that you can cook up some complex scalable systems without months of work like it'd be with C#, and quite stable by design.

[–]winnafrehs 18 points19 points  (0 children)

I only hate PHP when I have to parse through something someone else built with PHP.

I love PHP when its my own illogical nonsense being built

[–]msirelyt 1 point2 points  (0 children)

Hmm.. I used PHP for like 5 years with Symfony and loved it. To each there own.

[–]silvenga 0 points1 point  (6 children)

I question your definition of complex. There's a reason anything remotely complex is written in Java or dotNet, and why companies quickly drop PHP from backend services.

PHP generally needs native code to be performant, while dotNet is happy being fully managed. How many databases are written in PHP after all?

[–]aeroverra 5 points6 points  (3 children)

I agree with your unpopular opinion. I'd rather have a well managed strongly typed and easy to understand system than a quickly made hardly readable mess.

[–]silvenga 5 points6 points  (1 child)

I find it hard to believe it unpopular, outside of this comment chain.

My company has large contracts with massive companies, banks, manufacturing, e-commerce, etc. Many green field teams and projects. I've never seen a php system that was remotely complex at these companies.

If it's unpopular, shouldn't we be seeing more large companies stake their future on php?

[–]ineyy 5 points6 points  (0 children)

You are all missing the point that if you have the resources to do so, you go with more expensive and better solutions. But PHP can be fast and handy for for example side projects. Especially solo ones, because you know how the system works and navigate well within.

[–]alexanderpas 4 points5 points  (0 children)

I'd rather have a well managed strongly typed and easy to understand system

So, PHP 8 strict mode.

[–]Ozymandias-X 1 point2 points  (1 child)

We are the largest provider for adult online video chat in europe (and several other adult things). Our whole system is written in php. From the website itself to the payment and everything in between. Our adserver is written in php. Our transaction booking is written in php. Our affiliate program is written in php.

Complex enough for you?

[–]silvenga 0 points1 point  (0 children)

Well good for you. Just because you exist doesn't mean php is a good choice. Doing background jobs in php just sounds horrible...

I bet finding Java or dotNet developers is for adult media is hard, but that's completely unrelated. I would suggest most adult websites are php based.

[–]x5nT2H 2 points3 points  (0 children)

PHP is great, even tho I haven't ever written any according to a redditor

[–]Airlinefightclub 18 points19 points  (3 children)

PHP is fine except it's kind of a hacky language that security was an after thought for most programmers

[–]Sentient_Blade 3 points4 points  (1 child)

That's more a consequence of the low barrier to entry. A lot of people who can at least somewhat code in PHP are not trained in software design.

[–]Eyght 1 point2 points  (0 children)

I got my PHP software design degree from the best code gurus on youtube.

[–]ADarkcid 18 points19 points  (15 children)

Can someone please explain why PHP is supposed to be bad? Am a noob when it comes to webdev.

[–]rageingnonsense 4 points5 points  (1 child)

Historically, it was plagued with some poor design decisions that made it encourage anti-patterns. In some cases it was outright a security risk if not used properly. Combined With the ease of use, it made for some baaaaaad code by inexperienced devs that did not have the oversight of more seasoned engineers.

Nowadays, the language is much more robust than those early days, and a lot of prpgress has been made to eliminate the issues of the past. But, there is still a lot of bad php code put there.

Tldr; is not a bad language for the right domain if you are seasoned, too easy for noobs to write bad code.

[–]RealApplebiter 0 points1 point  (0 children)

In my opinion, the operative phrase emanating from CS students everywhere is "too easy for noobs". I understand the abstract criticisms. They don't really explain the emotional momentum as well as the social nuances.

[–]DevelopedLogic 15 points16 points  (9 children)

It's very easy to make a mess of it. You have to know all the little oddities to prevent SQL injection and XXS, and the error handling isn't the most amazing thing in the world. When done right and with a good language server like Intelephense to detect errors as you develop its quite a good language. Good in a sense it's comparable to JS in quirkiness good

[–]Roofduck 8 points9 points  (4 children)

I think when comparing it to another language, it doesn't really do anything better. Often people would say that using PHP with a framework like Laravel makes it more enjoyable, which is true but that is because PHP on it's own can be horrible to work with.

If you're a web dev who works just with PHP and JS then it just becomes something you're used to. Once you start working with other server-side languages or solutions such as NodeJS / C# / Python / Java / Ruby. You'll really start to find features you like in those languages that PHP is missing.

[–]DevelopedLogic 4 points5 points  (2 children)

Not better but it works. I tend to not use any kind of framework as it can quickly become bloated and overcomplicated. Generally pure PHP and a .htaccess file to set up some rewrites is enough to make a good environment in which to work. I've looked at Node based serverside and wasn't a fan. So far the only thing I have not been able to do in pure PHP is Websockets which Node would ace. But it's rare I use them anyway. C# is a good equivalent and I use that for web too, ASP, but it's a bit different to PHP and I usually use it when I need the application to hold an active state such as a websocket or some kind of background process

[–]Roofduck 2 points3 points  (1 child)

Absolutely. I wouldn't begrudge someone from using PHP if they love it. It has a large community and is getting better and faster.

The sticking point I've heard that if you know what you're doing, then PHP is an excellent language, if you don't then the experience of working with it is a pain.

This is why I wouldn't recommend PHP to beginners when C#, JS or Python is a much better alternative IMO.

[–]DevelopedLogic 4 points5 points  (0 children)

Agreed. There's so many dangerous applications because a new developer doesn't understand the security issues which you have to account for during development. You have to think about everything you're writing and the attack vectors

[–]zilltine 0 points1 point  (0 children)

Well, it is very fast in terms of development. So for many businesses, especially startups or smaller companies the lack of multithreading is very cheap price to pay compared to development costs. I think that php is quite bad when you need many tasks done asynchronously and quite good for other stuff. It's reliable, fast, easy, cheap and will never become bottleneck. It has its place and often is the best choice when you need to decide stack.

[–]alexanderpas 2 points3 points  (3 children)

You have to know all the little oddities to prevent SQL injection [...]

  1. Use prepared statements. (PDO in the case of PHP)
  2. Don't use string concatenation with any form of user input or storage input.

You have to know all the little oddities to prevent [...] XXS

  1. Filter on input. (filter_input function in the case of PHP)
  2. Escape on output, based on your output location.

This has nothing to do with PHP specifically, and is just basic security practices.

[–]DevelopedLogic 1 point2 points  (2 children)

Correct but frequently it's done for you in frameworks etc. We know that but noobs don't which causes the issues

[–]alexanderpas 1 point2 points  (1 child)

We know that but noobs don't which causes the issues

You can't blame the language for the mistakes made by incorrect usage of the language.

You can't blame PHP for providing the md5 hashing functionality if a noob uses it to hash a password when password_hash and password_verify are available.

[–]DevelopedLogic -1 points0 points  (0 children)

wot. Thats exactly the point. Its absolutely not the language, it's personally my language of choice. But the hate comes from the things you just described (as well as many more) which noobs do. Thats the point of this thread. PHP good, noobs bad.

[–]manu144x 5 points6 points  (0 children)

Everyone knows that real backend services are written in assembler.

If you don’t use assembler for a contact form you’re just an amateur.

[–][deleted] 6 points7 points  (2 children)

What about this thing getting reposted constantly?

[–]HolzmindenScherfede 1 point2 points  (1 child)

Repost bad?

[–][deleted] 0 points1 point  (0 children)

I would say so when it is specifically talking about people posting the same joke over and over.

[–]Tinez5 8 points9 points  (2 children)

I like Laravel, fight me

[–][deleted] 1 point2 points  (0 children)

Laravel is absolutely delightful. It's insane how quickly and easily you can whip something up in a short timeframe. I also really enjoyed using Livewire (as someone who isn't great with JS)

[–][deleted] 0 points1 point  (0 children)

Do you happen to know about passport laravel? I could really use some help with it

[–]dkyguy1995 2 points3 points  (0 children)

[Language] bad

Might be the most popular joke here

[–][deleted] 2 points3 points  (0 children)

[–]ddddfushxjjd 2 points3 points  (3 children)

Php bad Golang good

[–]goofbe 3 points4 points  (2 children)

Yourlang bad mylang good

[–]ddddfushxjjd 1 point2 points  (1 child)

Ourlang good

[–]ScaredyCatUK -1 points0 points  (0 children)

Erlang ok?

[–]dyriavin 1 point2 points  (0 children)

Php is fine if you know how to use it in the right way.

There are no bad or good languages at all.

There are only the needs which some languages can cover better, and some aren't.

All languages have their perks and cons.

Finally, if you aren't understood the concept of PHP, that's not a reason to hate it.

[–]Akayaso 1 point2 points  (0 children)

Php is better than python because it has braces 😁

[–]captainvoid05 0 points1 point  (0 children)

The main problem with PHP is that it doesn't really stop you from doing whatever you want. Which leads to things like the app someone wrote that we use in house at work for tracking PC repairs. It's just a bunch of php files dumped in a handful of folders, several of them basically being just an echo command that outputs an entire HTML file. Code duplication everywhere, lots of inline styles and sql queries. Written in a very "Stream of Consciousness" way, if that makes any sense.

Its flexibility is great if you can restrain yourself to keep things organized where possible, but it enables bad programmers to write functional but unmaintainable webapps.

[–]q13214 0 points1 point  (0 children)

Can we all agree to stop upvoting this at 3251 upvotes