Live data from Hacker News

25 Years of PHP

jetbrains.com

161–170 of 426 posts

Re: 25 Years of PHP

#161

Earlier quoted context omitted.

> PHP, on the other hand, is basically just worse-Java It’s much more like C than Java. And Java was in its infancy when PHP came out so it makes sense that it’s inspired more by C than Java.

Incorrect. Old PHP was more like C. If you see a modern, best practices, PHP code base today, it reads like Java 7 did in 2011.

Whats old is new again.

Laravel et al read like java. Nobody wants that crap anymore. Everyones moving codebases back to more procedural styles with a good dose of functional leanings towards immutable values.

Re: 25 Years of PHP

#162
post #88

Earlier quoted context omitted.

No one is claiming that PHP is and/or was without fault. The sentiment is that we built things that worked despite them.

That's not being fair. There are many comments on HN of people saying exactly that PHP just isn't bad. The grandparent reply even says: >My only real gripe with PHP is the annotation syntax.

I never said it was the only problem with the language. I said it was the only one that really bugged me. You're more than welcome to attack my opinion of PHP (which seems like a silly thing to do, but you're welcome nevertheless), but please don't put words in my mouth.

Re: 25 Years of PHP

#163
post #122

Earlier quoted context omitted.

> If PHP is a bad language, your complaints are just just irrelevant I don't really understand what you mean here. > I could probably find some bad code base made in Go and prove that Go is bad. "It is possible to write bad programs in PHP and also in Go, and therefore the languages are the same" YOu can write bad code in all languages, but PHP makes it harder to write good code. > The things is that from your commen…

I mean your proof is I seen PHP code then conclusion is PHP is bad. You are trying to compare PHP with Go, probably Go is better then PHP, but if Go is better that does not mean PHP is bad, just that Go is better (probably not for all use cases). So you have experience with PHP, probably are you thinking at html code mixed with PHP code? yeah that thing is bad but only news use that for large projects. If you do not…

> I mean your proof is I seen PHP code then conclusion is PHP is bad.

You're over simplifying my point to make yours.

I have seen bad PHP code. I have seen bad Go code. I have seen bad code in many languages.

The proportion of bad PHP code however, is higher in PHP, for the reasons I've stated around edge cases and the difficulty in reasoning.

> You are trying to compare PHP with Go, probably Go is better then PHP, but if Go is better that does not mean PHP is bad, just that Go is better (probably not for all use cases).

Go being good doesn't make PHP bad, and PHP being bad doesn't make Go good. I'm not saying one thing is true because the other thing. I'm saying that PHP is a bad language.

> So you have experience with PHP, probably are you thinking at html code mixed with PHP code? yeah that thing is bad but only news use that for large projects.

Nope, you're making untrue assumptions about my experience. The largest project I worked on was over 300,000 lines of PHP and used templating. It controlled everything from a companies finances, to printing plate layout, to believe it or not, sorting robots on a conveyer belt.

> If you do not mean that then I am not sure what PHP issues prevent you to write good code.

I've talked about this. Edge cases and the inability to reason about the code. In PHP there are a ton of weird little behaviours or edge cases that you just have to know about that could cause bugs. It's hard to know all of these, and even if you do the sheer number of intricacies of the language means that it would be easy to miss some.

PHP isn't alone in this. Go has little gotchas, Ruby has a fair few, Javascript has plenty, but PHP has loads.

Re: 25 Years of PHP

#164

Earlier quoted context omitted.

The parent comment claimed that PHP's former sins were being absolved. The quote you are referencing is about the current state of PHP.

The parent comment to mine, though, said: > No one is claiming that PHP is and/or was without fault. I'm emphasizing the "is" part. "No one is claiming that PHP is without fault." My comment is asserting that there are definitely people who say that PHP is not bad. I did not speak to whether anyone claims PHP was never bad.

I should have known better. My apologies, the person simias is replying to is not saying that PHP is without fault.

Re: 25 Years of PHP

#165
post #82

Earlier quoted context omitted.

> The only ceremony you need to write executable code is the This is a really underappreciated aspect to development in general and web development in particular. There are (or at least were) an awful lot of "shared hosting" providers which are cheap, convenient, and run PHP and CGI only .

ColdFusion, Java Server Pages, and other languages copied this syntax. I don’t see it anymore except with php. Does anyone know of any other languages still in use that have this?

I thought the comment was talking about PHP already being installed, so you could just start using it.

Re: 25 Years of PHP

#166
post #113

Earlier quoted context omitted.

I mean I'd say it's pretty rare. I've only seen a handful of people do it personally, and I've never seen anyone exclusively use a portrait screen.

With modern monitors being as large as they are already, I'd say the need for a vertical monitor is likely an indication you're working with spaghetti code.

With modern monitors being as large as they are already, I'd say the need for a landscape monitor is likely an indication you are working in callback hell.

Re: 25 Years of PHP

#167
post #129

Earlier quoted context omitted.

> "that's going to work the way I think it does" I definitely get where you're coming from. But everyone is different, and thinks differently. I did a lot of Rails after PHP, so I like using Coffeescript, even though that admission would get me mocked on any JS forum, since I've seen many people be called an idiot for not preferring Typescript. As for frameworks, I like Svelte, because it works the way I think. I've…

> I definitely get where you're coming from. But everyone is different, and thinks differently. You have talked about preference a lot, and I honestly don't really care what people do or don't prefer, that's totally up to them. I will judge people for it, in the same way I would question someone's judgement if they insisted against all evidence that there was nothing wrong with their shoe-hammer. Personaly I quite li…

> The problem with PHP is that there's a huge amount you have to know about the corner cases and edge cases that could cause you to write a bug or security flaw into your application.

The amount of PHP you need to know to avoid the sharp edges depends on the complexity of your application and what you're trying to do.

I don't make assumptions about what people are trying to build.

> I will judge people for it, in the same way I would question someone's judgement if they insisted against all evidence that there was nothing wrong with their shoe-hammer.

I also don't make assumptions about how a person evaluated and/or prioritized the tradeoffs involved with their choices, because their choice in itself doesn't tell a complete story.

Sometimes what might appear to be a bad choice was well reasoned at the time it was made. When Twitter was made, "Rails doesn't scale" was a common insult against it. But Twitter might not have been built they been forced to make it in Java.

Re: 25 Years of PHP

#168
post #157

Earlier quoted context omitted.

While I agree that PHP does have pros as well as cons, I find it disconcerting that I've read MANY assertions here on HN, that PHP detractors just haven't used it very much or are mostly complaining about things like bad standard library function names. I've used PHP in earnest. It and JavaScript are tied for worst programming languages I've used. JavaScript gets more of a "pass" from me because I'm just not a dynami…

I dont agree with you at all. Why are you building arrays with mixed key types? Why do you want type hints? Why do you need generics in a dynamically typed language? Php has pthreads. They just arent needed that often. Async is being worked on You didnt mention it but immutable types are also being worked on. Everything people complain about php over tends to actually make its way into the language eventually. I dont…

> Why are you building arrays with mixed key types?

It happens on accident. All keys are converted to ints if they can be. So if you read a file that is called "123", it'll suddenly become an int key whereas all the rest will be strings. That's absolutely insane.

> Why do you want type hints?

The same reason anybody does. It is a contract and it makes your code more well-documented, more robust, and more correct. There's a reason that PHP has typehints and the consensus in all major, current, PHP projects is that they are good.

> Php has pthreads. They just arent needed that often.

Pthreads is garbage. Always has been. Never worked on servers. Is deprecated, finally: https://github.com/krakjoe/pthreads/issues/929 https://www.php.net/manual/en/intro.pthreads.php

> Async is being worked on You didnt mention it but immutable types are also being worked on.

PHP will be less awful when they're done. It's still awful today. I don't revel in PHP being bad. If it's good some day, I'll be happy.

> Everything people complain about php over tends to actually make its way into the language eventually.

25 years. 25 years and the language still sucks. Just use Java (or better yet, Kotlin).

> I dont know when you tried php, but I dont really think it was in earnest. It sounds like you had problems keeping your types straight.

I've been doing PHP dev for years now. Of course I had trouble keeping my types straight. PHP turns everything into a string whenever it can. Except sometimes it turns strings into ints for some unholy reason. Also, the type system (like Java's) sucks. It's not expressive at all and I can't even return a collection of a single type without resorting to language extensions.

> I agree its not super natural to deal with the php type system but once you learn it its pretty simple to keep things in order.

Not being natural is not the same thing as being broken. And being able to remember all of the gotchas doesn't make it simple.

> I see most messes arise when people mix types, mutate variables carelessly, or otherwise over leverage things they shouldnt (e.g. globals)

Agreed. So how do we avoid mutation? Use `clone`? Nope. It's shallow and everything is mutable by default. Overload `__clone()` on every class you write? Okay, but you better hope that your classes don't have fields that DON'T implement deep cloning...

> But these are hygiene problems, and all languages have these.

Bull. No language is perfect. But tell me, what's worse: 1 issue or 1,000 issues? Come on.

> Ive seen garbage java, ive seen hairballed rust, ive seen pretty much any c, ive seen wanky golang and ive seen babel-typescri-rea-tsx

See above. This is the most bottom-of-the-barrel excuse I keep reading over and over. PHP ENCOURAGES garbage code. Rust does not. Not even in the same ballpark. Not even playing the same GAME.

> The only thing that really annoys me about php these days is the dollar signs.

lol

Re: 25 Years of PHP

#169
PHP as a programming language is... okay. And it has come a long way in recent years to become "okay". But frankly, wasting another keystroke regurgitating to tired old "PHP sucks" trope would be to completely miss why PHP is so great (hear me out).

PHP as a development paradigm is second to none. The reason to choose PHP isn't because it is such a great language, the reason to PHP is because it gives you the most power for the least effort compared to any platform targeting the web (fight me).

PHP is dead simple. I can make a new directory with a single index.php file and view it in my browser in less than 10 seconds. I can then change/add more files, hit F5, and immediately see those changes reflected on my screen. It is the tightest feedback loop possible. I didn't have to remember/rely on any CLI helpers or package managers or debug tools. I didn't have to redeploy or recompile or restart anything... none of the bullshit. Just one file in one directory with zero indirection. And we aren't even done yet!

PHP also gives you a built-in web framework out of the box. It automatically parses server/request information and hands it to me for processing into a response. What's that? I don't need a special templating engine to format my output nicely either? PHP is a templating engine! Did I mention routing is also built-in (and transparent) as well?

The above is why PHP has become so popular/beloved by so many (and hated by many more). Everyone complaining about the language features ("array doesn't work the way I want it to!") is simply putting their ignorance on full display. There is nothing wrong with wanting something else out of your development environment/paradigm (heck, I've moved on too!), but don't blame PHP because it doesn't conform to your idea of how an application should be written.

The above is also why I am so disappointed by the direction the PHP community seems to be taking the language. I am all for improving PHP as a language, but to be honest, I have a feeling the maintainers are going to prove all of those people that claim "PHP is just a worse Java" right... PHP will never be as powerful of a language as Java or C#, and for the reasons I explain above, it doesn't matter! Nobody is choosing PHP because of the language (if they were, they would have chosen Java/C# in the first place).

If you want to improve PHP, improve upon the things that make it great. Lean in to templating. Lean in to a more functional approach. Lean in to includes. Screw it, add some more magic! Make the platform more ergonomic. It was always the draw anyway. Who cares about the language...

Re: 25 Years of PHP

#170
post #6

PHP is damn fast now, no joke. And with all of the modern features it's actually not so bad to work in. I'm becoming increasingly puzzled every time I see PHP hate now, especially when I read tired comments like "just use rails". Laravel is arguably as good or even better than rails at this point, and PHP 7+ is definitely light years faster and lighter. One thing that still sucks is package management / composer.

To be fair most package managers suck.
Post reply on HN