Live data from Hacker News

25 Years of PHP

jetbrains.com

261–270 of 426 posts

Re: 25 Years of PHP

#261

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…

> Keys are sometimes strings, sometimes ints. And you don't always know which it is! Could you give an example? Because I've never had any issues with it and find it very predictable. > The fact that you can't typehint everywhere also sucks. Type-hinting is being implemented and is already available in most places. But why you'd expect that in a dynamically typed language is beyond me. > No generics sucks. Again, dyn…

Your response is almost exactly the same as waheoo's. Please see my reply to his for everything you asked here.

Re: 25 Years of PHP

#262
post #194
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

Nothing "wrong" with PHP itself, but it's clearly not designed for modern web programming patterns which makes it feel outdated. No separation of model-view-controller, not friendly for API or AJAX, no class structure until later add-on, and so on.

Please use a framework - Laravel / Symfony has all of these

Re: 25 Years of PHP

#263

Earlier quoted context omitted.

> This revisionist stance that there was never anything really wrong with PHP This strikes me as a strawman. PHP spent years being a generally loathed language for reasons that at this point aren't really worth reiterating. But, in an analog to Javascript, it has made progress, grown up and become a better language. One of the best? Like Javascript, no. But serviceable at worst. I stopped earnest work in PHP ~ 5.7. I…

Javascript has made progress too. While far from perfect and I think PHP's journey started at a worse point has has gone further JS certainly is a lot better now and the major failings of JS are of it's ecosystem and not the language itself. I also think that both JS and PHP get a lot of flak for maintaining backwards compat as far back as they do. You can run a lot of webapps (frontend and backend) from 10-20 years…

If you don't do that, you get the python 2 to 3 transition. Which is still going on.

PHP did drop some stuff between 5 and 7, but all of it had been marked deprecated for some time prior (often years).

Re: 25 Years of PHP

#264

Earlier quoted context omitted.

Javascript has made progress too. While far from perfect and I think PHP's journey started at a worse point has has gone further JS certainly is a lot better now and the major failings of JS are of it's ecosystem and not the language itself. I also think that both JS and PHP get a lot of flak for maintaining backwards compat as far back as they do. You can run a lot of webapps (frontend and backend) from 10-20 years…

> Javascript has made progress too. To be clear, this is what I was saying when I called upon it as an analog.

Ah, then I misunderstood. Thanks for clearing up

Re: 25 Years of PHP

#265

Earlier quoted context omitted.

Just like I tell people that buy cordless drills at Harbor Freight, "sometimes it IS the tool". Does that mean you can't build fast, meaningful, cool things with it? Of course you can. But, the deeper you get, the more problems you'll have to solve with weird esoteric knowledge. I'll agree with all of your points on horribly inconsistent and broken language features. I get that people that have grown up with the lang…

And I think you've hit the nail on the head here. People who defend PHP as "not that bad" are probably people who have used it for so long that they just work around its insanity by muscle memory. It is NOT okay that `foreach` leaves an allocated reference to the loop-local value.

And probably people who haven't used anything else, so they have no frame of reference to compare it to, which they would need to realize how terribly and unnecessarily bad it actually is.

Re: 25 Years of PHP

#266

I've been working with PHP for a very long time and apart from web it is also very good at writing shell scripts too. One of my recent project called 'howdoi' (1) is written in less than 70 lines of code (ignoring ws) - no libraries, no deps and backward comptabile to 5.0. Just copy-paste the file and it's go! If you know how to use it, it's really useful language. (1) https://news.ycombinator.com/item?id=23230157

I'm really surprised that PHP hasn't picked up in this area. It's a great tool when you're too big for bash, but not big enough for, well, a "more proper" language...

Yeah an in-place file-editing feature like Perl or sed has would make it very useful for command line use too.

Re: 25 Years of PHP

#267
It has been a long time since I have had to deal with Other People's PHP and I have never had to with my own. Mostly, I have had to at least glance over student projects that had security issues I could drive a bus through, honking and dragging a bunch of rusty bikes.

In terms of language design, I couldn't speak to it. I've never designed a language and they are intensely personal things. However, I have the vague sense that the culture of PHP (installed by default, easy to get working) created many fire-and-forget projects done to scratch an immediate itch with no sense for maintenance. It works? Ship it.

You can write obfuscated code in any language, but some languages have a culture which encourages it, such as Perl. Similarly, I think many perceptions of PHP arose from a "make it work, now, anything else is someone else's problem later" mindset I saw from the people who were developing in it.

I would be interested in other perspectives.

Re: 25 Years of PHP

#268

Earlier quoted context omitted.

And I think you've hit the nail on the head here. People who defend PHP as "not that bad" are probably people who have used it for so long that they just work around its insanity by muscle memory. It is NOT okay that `foreach` leaves an allocated reference to the loop-local value.

And probably people who haven't used anything else, so they have no frame of reference to compare it to, which they would need to realize how terribly and unnecessarily bad it actually is.

I didn't want to say it for fear of coming across as condescending... but, yes.

Re: 25 Years of PHP

#269

Earlier quoted context omitted.

> Keys are sometimes strings, sometimes ints. And you don't always know which it is! Could you give an example? Because I've never had any issues with it and find it very predictable. > The fact that you can't typehint everywhere also sucks. Type-hinting is being implemented and is already available in most places. But why you'd expect that in a dynamically typed language is beyond me. > No generics sucks. Again, dyn…

Your response is almost exactly the same as waheoo's. Please see my reply to his for everything you asked here.

Yeah, I noticed after I'd missed your reply there the first time around. Sorry.

I'm still confused about the array keys though. I'm not sure I understand the example you gave in your other comment.

And I'm also curious which Apache and Nginx has PHP installed and enabled by default.

Re: 25 Years of PHP

#270
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

> Is it a perfect language? No. But which language is?

This has got to be one of the worst arguments (or rather, pieces of rhetoric) there is [0].

[0] - https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallac...

Post reply on HN