Live data from Hacker News

PHP in 2022

stitcher.io

151–160 of 318 posts

Re: PHP in 2022

#151
post #34

Earlier quoted context omitted.

> Compare this to, say, the bootstrap time for Python or Java The bootstrap time for a request exists only in a web framework, not in the language. And since you can have the extremes of pure fastcgi or uwsgi, or full Django, you need a more specific comparison.

Java has a high bootstrap time for the JVM. PHP doesn't have that, but the "tear down everything" model might imply a high bootstrap time depending on the framework, because things need to be bootstrapped per request that are already there in Java.

Regarding bootstrap time, have you tried cold PHP, like a cgi script or a PHP script run from shell? Not fast at all. I guess you are comparing PHP with mod_php (or something similar that already has a running interpreter in memory). In that case, it would be fair to compare it against something with JVM in memory, like Tomcat or Jetty.

Re: PHP in 2022

#152

Hating on PHP almost feels like racism. All the arguments are biased or false. I always get sad after clicking on PHP articles on HN.

I would argue that racism comes from ignorance and insecurity.

A lot of frustration with PHP comes from using it a lot (not ignorant) and not enjoying it. They want to be better programmers than they language would allow.

Granted, PHP has improved a lot since I last used it (2004). I think a lot of the arguments were true, but are no longer valid.

Re: PHP in 2022

#153
I use PHP for my backend work. I don't claim to be an expert, but I have been writing in it for over 20 years. I probably started by rewriting PHP-Nuke to emit actually valid XHTML (what a chore -never again). I've written a couple of CMSes in it, and many plugins.

I've done some fairly big stuff, in PHP.

Works a treat. Fast, solid, secure. Widely-supported, great way to have a high "bus factor," because so many people can understand it.

All that said, I never did really like the language. It has always been a necessary evil, for me.

Re: PHP in 2022

#154

I started my career in PHP ~15 years ago trying to do OOP in PHP 4.x. That was "fun". In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level. I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and…

> Why would I choose PHP when starting a greenfield project? LAMP stacks are super ubiquitous, open source, cross-platform, and in many cases to deploy your app you don't need to configure anything, add any modules or dependencies... just copy your files in place. A small project (e.g. contact form with a CAPTCHA) could be just a small file named whatever you want, which you can place anywhere in the public directory…

Haven't thought of this, I guess for some people it makes sense especially for small, personal projects. I'm more biased towards startups with a plan to grow or larger projects.

In my case if the hosting provider doesn't have something like DigitalOcean's droplets I'll still rely on docker compose instead of the default stack deployed on the system whatever stack I'm choosing. But yeah that's raising the bar too much for most people especially for a couple of scripts or pages.

Re: PHP in 2022

#155
post #147
post #27

Earlier quoted context omitted.

More like thirteen. Apparently I misread the comment I was responding to as "for two years some time ago". Now I'm not sure why someone would have chosen PHP for such a task two years ago.

Sorry for unclear phrasing. I meant I used php from 2018-2020. And honestly I don't know why to use php for the task. I started at the company 2018 and the tech stack was given. A good compensation and praising like "PHP has changed and now supports types etc." let me take the opportunity. My bad, because it took me a lot of time. I needed to do benchmarks were actually PHP turned out to have comparable performance i…

The problem with PHP in this case has nothing to do with types. So their reasoning was wrong from the very beginning. I suspect that no amount of "catching up" will help here, just like no amount of development will turn future axes into screwdrivers. They'll still work like perfectly good axes, though. Just like PHP will still be able to handle HTTP requests perfectly well.

Re: PHP in 2022

#156
post #9

Is it just me or PHP's evolution is a bit "too little, too late" for an almost 30-years old language? PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course. That, and also the fact that it ma…

It's still in major use across the industry so I don't think it's too little too late. Maybe late, but not too late. I think it's pragmatism is partly why it's still so popular. No need to rush to the next best thing as PHP is perfectly capable of taking you from side-project to enterprise software with millions of users.

Re: PHP in 2022

#157

I started my career in PHP ~15 years ago trying to do OOP in PHP 4.x. That was "fun". In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level. I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and…

> I'm curious what is the value proposition of the latest PHP version(s). I think more and more people have started to realise that typed languages make better, more reliable software. The incremental additions to PHP's type system are just a move towards this, I think and can be seen in other languages such as Typescript. I'm just not a fan of dynamically typed languages anymore, even for small scripts. > Why would…

I think that says more about your particular mental model of programming than about programming in general. In the couple of decades I’ve been coding, I’ve seen good use of both dynamically/weakly-typed and strongly typed languages.

Sure— thinking you’re going to save time writing more complex applications by avoiding boilerplate is flatly wrong. However, if boilerplate would be a double-digit percentage of your code, you probably will save time avoiding it because any unlikely dynamic typing issues will be easily resolved. But if it’s small enough to be inconsequential and you’re in the typed-language zone, why not use your typed language, anyway?

Avoid dogma and use the right tool for the job, I say.

Re: PHP in 2022

#158

Hating on PHP almost feels like racism. All the arguments are biased or false. I always get sad after clicking on PHP articles on HN.

I would argue that racism comes from ignorance and insecurity. A lot of frustration with PHP comes from using it a lot (not ignorant) and not enjoying it. They want to be better programmers than they language would allow. Granted, PHP has improved a lot since I last used it (2004). I think a lot of the arguments were true, but are no longer valid.

And juvenile programming language tribalism. You could compile hundreds of pages of ranting about any language and their ecosystem if you wanted to. Some people need to learn that just because you prefer one thing over the other it doesn't mean all the other things suck.

I also suspect a lot of the people complaining about X language/platform/ecosystem are not even using them in production environments judging by their very idealized view on building software.

Re: PHP in 2022

#159
post #74

I learned to use php when I was like 14. I’m 27 now and still derive such joy when making my own little projects that will never see the light of day. I try to be humble as far as just being a php trash coder, but I don’t feel too ashamed honestly, as it is the most mainstream thing really. I will always be grateful to php for being accessible and yeah, I guess easy. I don’t know why php is the only one I really stuc…

In a world where everything is fast becoming a JavaScript front end with “some” backend and with the improvements PHP has seen in recent years I don’t see why you’d consider yourself a “lowly” php developer. I’m mainly a C# guy myself as far as the backend goes, but I don’t view PHP as being bad in 2022. I think people who do are stuck in the past to be perfectly honest. It’s sort of like disliking JavaScript because…

> why you’d consider yourself a “lowly” php developer.

PHP has always been considered as a somehow bad language in all corporations I've worked at to date. The same applies to other script languages such as python, ruby or nodejs - but PHP was the most undervalued of them all.

It's kinda strange because the language is really performant and relatively easy to use.

Maybe that's exactly why the big brain architects don't like it. They do tend to love things correlated with pointless complexity after all

Re: PHP in 2022

#160

I started my career in PHP ~15 years ago trying to do OOP in PHP 4.x. That was "fun". In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level. I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and…

> Why would I choose PHP when starting a greenfield project? For me, the answer is Laravel.

If I'm forced to choose PHP that's the choice I would also make in most cases, probably because it reminds me of some of the things I liked about Rails.
Post reply on HN