Live data from Hacker News

PHP 8: Before and After

stitcher.io

141–150 of 346 posts

Re: PHP 8: Before and After

#141

Few months ago I was debating with a friend working since 15 years on PHP, my point was php is slow and max throughput is 200-500 rps, which is quite low compared to Go, node.js, C# and others, he answered that 100-200 request per second is more than enough for most use cases. I'm working on systems with 25K RPS at peaks, but for simple projects and small companies he is right ... But why should anyone start a new pr…

"he answered that 100-200 request per second is more than enough for most use cases" Exactly this. If you already know PHP and can produce results (mostly CRUD apps) and it doesn't need millions of rps, why do we need to use another language because they are so much better ? So much better at what ? It is like saying "I have a hammer, so everything looks like a nail to me". Not every web app has to be written in Lua/…

Reminds me of "PHP Hammer"

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

edit: Flickr user @raindrift made an actual PHP hammer, famously https://www.flickr.com/photos/nicoletbn/6949293600

2012 discussion of hammer https://news.ycombinator.com/item?id=3866488

TechCrunch defence of the hammer https://techcrunch.com/2012/07/28/not-that-kind-of-filthy-ge...

Re: PHP 8: Before and After

#142

I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…

More than anything, I find the language $ugly. Is that fair? No. Am I being unreasonable. Yes. Do I love PHP? Gross. I just have to live with it and go past the ugly syntax. It’s like an unhappy marriage. It’s just fine.

But that's just like your opinion man (quoting the Big Lebowski). I like seeing the $ sign. Does that mean I am not a good developer ?

Re: PHP 8: Before and After

#143

Few months ago I was debating with a friend working since 15 years on PHP, my point was php is slow and max throughput is 200-500 rps, which is quite low compared to Go, node.js, C# and others, he answered that 100-200 request per second is more than enough for most use cases. I'm working on systems with 25K RPS at peaks, but for simple projects and small companies he is right ... But why should anyone start a new pr…

"he answered that 100-200 request per second is more than enough for most use cases" Exactly this. If you already know PHP and can produce results (mostly CRUD apps) and it doesn't need millions of rps, why do we need to use another language because they are so much better ? So much better at what ? It is like saying "I have a hammer, so everything looks like a nail to me". Not every web app has to be written in Lua/…

well, on the other hand, if you are starting from scratch as a new developer, trying out go or rust is not too risky as large orgs backing it up. Also, for me, hosting go is much easier than php, as I am not from that era.

Re: PHP 8: Before and After

#144

Few months ago I was debating with a friend working since 15 years on PHP, my point was php is slow and max throughput is 200-500 rps, which is quite low compared to Go, node.js, C# and others, he answered that 100-200 request per second is more than enough for most use cases. I'm working on systems with 25K RPS at peaks, but for simple projects and small companies he is right ... But why should anyone start a new pr…

That's true, until a stupid non-rate limited web spider takes most of your resources.

Re: PHP 8: Before and After

#145

A lot of those changes look like good things taken from other languages that have done it well (the null ?-> and ??, ...). But many things seem to be quite of a burden instead of a progress => why create a new match syntax when a switch is already well known for something similar? That will create confusion (thinking of all the for types of loops in JS!), plus it's still not an enum and cases will be missed. And the…

> And the worst being the attribute #[] syntax... why?! Almost every other language uses @attribute, and it is successful: simple to write, easy to read, why on earth a new and such complicated solution? Simple, it was already taken up [1]. Also `@attribute` syntax is by no way universal (and semantics wildly vary even with the same syntax): `#[]` in particular might have been inspired by Rust. [1] https://www.php.ne…

The rfcs have a lot of discussion on those subjects indeed, but I still disagree with the choice!

Also, the current use of @ is before a function call or some get, not before a method/class/... declaration, so a change in that direction would probably be possible. (plus the @ to suppress errors should probably be removed from the language anyway!)

Re: PHP 8: Before and After

#146

Few months ago I was debating with a friend working since 15 years on PHP, my point was php is slow and max throughput is 200-500 rps, which is quite low compared to Go, node.js, C# and others, he answered that 100-200 request per second is more than enough for most use cases. I'm working on systems with 25K RPS at peaks, but for simple projects and small companies he is right ... But why should anyone start a new pr…

Well, good performance of http request/response cycle is mostly related to async operation, in some form, when long-lived daemon can process big amount of requests without spending time on initialization. Workerman and swoole, powered by async PHP approach, are very fast and suitable for high load. The problem with async PHP, though, is that you need to be careful with libraries (e.g. mysql client) because most of them were designed with short-lived PHP script execution in mind.

Re: PHP 8: Before and After

#147

Earlier quoted context omitted.

"he answered that 100-200 request per second is more than enough for most use cases" Exactly this. If you already know PHP and can produce results (mostly CRUD apps) and it doesn't need millions of rps, why do we need to use another language because they are so much better ? So much better at what ? It is like saying "I have a hammer, so everything looks like a nail to me". Not every web app has to be written in Lua/…

Reminds me of "PHP Hammer" I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there. You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes. You pull out the hammer, but to your dismay, it has the claw part on both sides. Sti…

That's funny and all, but it doesn't drive home much more of a point than "PHP is bad because PHP is bad". The insinuation that all "houses" built with PHP are defective and waiting to fall apart is so obviously untrue that it feels unworthy of discussion.

A more reasonable analogy would be that there's a standardized toolbox that carpenters use that's weird, quirky and sometimes so bad that you need to know workarounds to use it correctly, but the houses that are being built do what they're supposed to in the vast majority of cases because most of the carpenters know the quirks well.

The question then is, if you're contracting someone to build your house, or you're the manager of a construction company, do you go with the standard toolbox that's used by the X% majority of carpenters, or do you hire carpenters that use more obscure (but functionally "better") toolboxes while running the risk of now ending up with unmaintainable or deviating houses that are hard to recruit additional carpenters for because they refuse to work on what is quite objectively "non-standard" houses?

The answer in my mind is no less complex than it would be for software development: it depends, and you should be wary of anyone telling you that it's "obvious" that the answer is one or the other.

Re: PHP 8: Before and After

#148
post #26

Earlier quoted context omitted.

This is such a shallow elitist comment. A lot of the common criticisms levied at PHP have been corrected years ago, and PHP is responsible for hundreds of billions of dollars of turnover globally. Of the top 10 websites in the world, PHP is partially or wholly powering more than half of them. Wikipedia, Wordpress, online retail. I have personally created 6 figures of value because I could quickly dump some PHP script…

How can you call this elitism? Nobody forces you to learn PHP, you can learn any of the many other open source existing languages. There's no gatekeeping preventing you from learning languages other than PHP. I'm just calling it for what it is: a broken tool. I'm suggesting we let go of this broken tool and focus on tools that already work great, instead of wasting millions of human work hours on sub-par coding. Sure…

>I'm just calling it for what it is: a broken tool.

Thats what every Rust-Fanboy says about the C/C++ Ecosystem

Re: PHP 8: Before and After

#150

Earlier quoted context omitted.

> It's becoming kind of an Enterprise language It tried for decades to be one with Doctrine, Symonfy and co, trying to copy the worst of Java EE with every single possible design pattern implemented in these frameworks, XML configuration files and co... The problem is no generics, no private packages makes PHP OO a horrible mess compared to Java (or C#).

I agree with you. Symfony and composer in general has just turned our code base into some kind of fugly java like monstrosity. When I used composer the first time I really enjoyed it, that project also used Silex a minimalistic symfony2, which I also really liked. But what I found out is that in general it is really terrible to be dependent on others, as Silex was dropped by Potencier and my project is left in limbo,…

PHP is filled to the brim with bad frameworks with one size fits all type of mentality. Just avoid them and make your life easier.

If you need a framework, look for something small, small enough to read thru and understand in one hour.

Post reply on HN