Live data from Hacker News

25 Years of PHP

jetbrains.com

121–130 of 426 posts

Re: 25 Years of PHP

#121
While I don't use PHP today, it always makes me wonder at deceptively easy it is to deploy a PHP app.

There's no having to worry about restarting processes since the next request picks up the code changes and deploying at scale has so many problems auto-solved by that such as rolling restarts.

You can then handle things like percent based feature roll outs at the application level which is likely where it belongs anyways.

On the flip side, for single server deploys, you can also get by with zero down deploys without needing to set anything up. Most other languages and frameworks can't do this, or the way they do it involves doing very complicated things or using even more complicated tools to solve the problem for you.

It's funny to think back in the early 2000s I was using PHP and deploying was brain dead simple then, but fast forward almost 20 years and it's still pretty much the case today -- at least it seems that way based on the talks I've seen around using PHP in production over the years.

Re: 25 Years of PHP

#122
post #90

Earlier quoted context omitted.

> your favorite language prevents you to copy paste code, have variables shorter then 4 letters "here's one place that PHP doesn't prevent poor quality code that is the same as other languages, and so all languages are the same" No languages prevent these things (that I am aware of), but not all languages have the same number of edge cases that PHP has. > and also fixes the bugs for you, let me know this cool languag…

If PHP is a bad language, your complaints are just just irrelevant, I could probably find some bad code base made in Go and prove that Go is bad. > but not all languages have the same number of edge cases that PHP has. I agree , some have more some have less The things is that from your comment it shows you have no idea what you are talking about, I suggest you let people with experience in PHP to explain hat are the…

> 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 comment it shows you have no idea what you are talking about

Yes, my 21+ years of experience writing code in over 10 different languages, including a decent amount of time writing PHP, pretty much means I don't know what I am talking about.

> I suggest you let people with experience in PHP to explain hat are the issues and how to work around them.

> What I could complain about PHP are small things I do not feel that I need some feature from Java or C#

I am not talking about features. In fact, Go has a surprising lack of features, it's one of the things that makes it pleasant to write, and easy to write well.

Re: 25 Years of PHP

#123
post #88
post #73

Earlier quoted context omitted.

Every time there's a story about PHP there's a comment like yours, and then in reply there's a comment like mine: Yes it's perfectly fine to use PHP if it's a productive environment for you. Of course it's possible to write good software with it. Of course a skilled developer will manage to do great things with sub-standard tools. Many extremely popular websites were and even still are powered by PHP, that's undeniab…

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.

Re: 25 Years of PHP

#124
post #103

Earlier quoted context omitted.

OTOH, sometime you need state, then you feel stuck with a half-finished language.

What are you using state for in a web app or API?

Yeah sure, no need for state in a CRUD API. But while it is the most common use case for PHP applications (well actually for application written in scripting languages working with http servers), it's not the only use case.

When the only place where you can put state is the database then every piece of state is written in the database. Which lead to intelligent individuals (no pun/offense intended) to write clever piece of infra such as Redis. The truth is, for 10 Redis deployment there's 7 (8? 6? Well, a substantial part) where a long living process holding little state would have done the trick. Now you need to deploy, maintain and scale Redis too.

Re: 25 Years of PHP

#125
post #76

Recently I have been thinking about moving my personal blog from Wordpress to a static site generator, because I don't allow comments or use Wordpress plugins. (Those who want comments can still use a combination of a static site generator and Disqus.) It occurred to me that once I did that, I could completely disable PHP on my Apache installation. It made me wonder how much usage of PHP out there is essentially a hi…

But Movable Type was written (mostly) in Perl... I'm not sure I see how Movable Type affects PHP all that much, but maybe I'm missing something.

Movable Type was popular, but a change in its licensing terms led to people leaving it in droves for Wordpress which had a similar interface and approach. Fast forward to 2020, and Wordpress installations reportedly make up the majority of PHP use in the world.

Re: 25 Years of PHP

#126

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...

Re: 25 Years of PHP

#127
post #53

Earlier quoted context omitted.

> Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. To clarify, comments never affect running code in PHP, ever. What's often done however is that tools like ORMs, or web frameworks offer a 'compile' step that parses these annotations (just like it's common in Java) and dumps a PHP file that maps things in the annotations into actual PHP code. For example, you can use it in Symfony to wire routes to handling f…

Yeah I worded that poorly, but once I went full on caps I decided to leave it, ahem :/. I get the idea of a compile step, and that's totally fine. But these annotations are commented out. It's very icky to be using them for anything other than documentation -- which is what comments are for, after all. Java's annotations are a bit different. Sure, the compiler does things with them -- the runtime does, too --, but th…

To be fair, I've been working in PHP for nearly 20 years and I've been able to avoid annotations almost entirely, except for that one time I used Doctrine and then threw it in the trash.

Re: 25 Years of PHP

#128
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…

>My only real gripe with PHP is the annotation syntax. Yikes. Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. Who came up with that? Agree. The first time I ran into this, I was completely confused as to why my code wasn't running as expected. Then I noticed the strange formal structure of the comments, made changes there, and voila. I don't understand why that feature wasn't implemented as decorators or som…

It's pretty terrible. ORMs like Doctrine use annotations because their philosophy is that a data mapping class should be a pure class that you decorate with annotations. I personally hate that approach and have had no issues avoiding this path over 20 years of PHP development.

Re: 25 Years of PHP

#129
post #94

Earlier quoted context omitted.

In my experience, and of course opinion, yes. Java might also be "bad", I don't know. I programmed it for a bit but didn't like it so moved on. The main problem with PHP, the real killer, is not that it's complex, or the needle/haystack parameters to functions changed, or the iffy string escaping/unescaping or all that stuff, it's that it's hard to know all the edge cases in the language that could cause you to write…

> "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 liked Objective-C, but a lot of people kinda thougt it was the devil in programming language form.

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. It's like there's an encyclopedia of weird behaviour that you have to remember all of, and it's going to be hard to remember all of the issues in all situations.

Re: 25 Years of PHP

#130

Long time ago I was learning Perl, because at that time basically the whole Internet ran on Perl CGI scripts. I thought, "man, Perl is weird". Then I learnt PHP, because whole internet seemed to move to Apache+PHP. I thought, "man, that's Perl done right!". Then I actually learnt Perl, looked at my PHP code written earlier. I thought "WTF?" Now I use Python. I think "man, why I have to type this silly whitespace?"

I can't wait to see what's next for you!
Post reply on HN