Live data from Hacker News

PHP 8.1.0

php.net

41–50 of 286 posts

Re: PHP 8.1.0

#41

I've been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying "PHP has come a long way. It's a proper language now, etc." If you work long enough with a language and figure out most its quirks, it's a breeze. It's nice that they are adding all these new features, but they are hardly what makes it or break it for me. Here is the one features that is taken for g…

Is oopsing 50 times per minute a good thing?

If you're doing iterative development, why not.

Re: PHP 8.1.0

#42

I've been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying "PHP has come a long way. It's a proper language now, etc." If you work long enough with a language and figure out most its quirks, it's a breeze. It's nice that they are adding all these new features, but they are hardly what makes it or break it for me. Here is the one features that is taken for g…

Is oopsing 50 times per minute a good thing?

No, not just oops. I get to see the state of the entire application with different values.

Re: PHP 8.1.0

#43

I've been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying "PHP has come a long way. It's a proper language now, etc." If you work long enough with a language and figure out most its quirks, it's a breeze. It's nice that they are adding all these new features, but they are hardly what makes it or break it for me. Here is the one features that is taken for g…

Same folks say Perl is unreadable because the syntax for certain aspects of the language is unfamiliar to them.

Re: PHP 8.1.0

#44
post #24

Earlier quoted context omitted.

Phabricator is not written in "modern PHP", so your experience is not surprising

Can you link something written in modern PHP?

most of projects based on Laravel/Symfony that are < 5 years old

Re: PHP 8.1.0

#45

I've been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying "PHP has come a long way. It's a proper language now, etc." If you work long enough with a language and figure out most its quirks, it's a breeze. It's nice that they are adding all these new features, but they are hardly what makes it or break it for me. Here is the one features that is taken for g…

Is oopsing 50 times per minute a good thing?

Of course not, it is just a way to show how fast things can go with PHP.

Re: PHP 8.1.0

#46
post #37

Earlier quoted context omitted.

PHP at its core is the best part. A whole bunch of optimized and well tested C functions that are typical of backend functionality. If you can do as little as possible in PHP and rely on the low level functions to stitch together what you need, deserialize and render data in the front end, use front-end templating, then PHP is insanely fast, practical language. The issues with PHP are usually when people build out gi…

I've worked on _many_ PHP projects. Unless it's a small single-purpose script, if you tell me it doesn't use one of the standard frameworks, I'm going to assume it's an absolute unholy mess of spaghetti. Laravel and Symfony are both extremely good, and the only reason people don't use them tends to be out of misplaced arrogance. Unsurprisingly, they end up building their own awful framework, and at some point the pro…

I have seen plenty of PHP projects without any frameworks used. Big ones as well. One of these projects is automation for a complete manufacturer factory. Robot controllers, Serial hardware drivers written in PHP, Realtime application with PHP instances running for multiple years. No frameworks used at all. There is more than only webapps.

Re: PHP 8.1.0

#47

I haven't written PHP in years but I get the feeling from this release that they are taking inspiration from TypeScript and JavaScript.

They take inspiration from everything! I think that's one of the most interesting aspects of PHP design since version 5.0 is that they sort of unpretentiously take the good concept and syntax ideas from any language that has them.

Re: PHP 8.1.0

#48
post #13
post #7

Fibers "allow blocking and non-blocking implementations to share the same API" That's an interesting contrast to Python where the need to use "value = await fn()" v.s. "value = fn()" depending on whether or not that function is awaitable causes all kinds of API design complexity, all the way up to the existence of tools like https://github.com/python-trio/unasync which can code-generate the non-async version of a lib…

But if you are writing framework or library that has to deal with both, its: result = fn() if isawaitable(result): result = await result And turns out isawaitable is not that fast so things like GraphQL libraries that run above logic thousands of times per request get noticeably slow.

I wrote a bit about that pattern last year: https://simonwillison.net/2020/Sep/2/await-me-maybe/

I didn't realize it had a significant performance overhead though, I should look into that.

Re: PHP 8.1.0

#49
Question: does class_exists still return TRUE when given the QCN to an enum?

Because it's not possible to instantiate an enum, if one appears in the constructor of a class it'll break auto-wiring. I've written my own IoC containers and one fundamental assumption in them is that when class_exists returns true, it is what it says on the tin. Using a specialized factory would still be possible. I wonder if other containers would break on seeing enums as well, but I hope they fixed this because it's not mentioned in the breaking changes. The documentation for class_exists doesn't mention enum.

Re: PHP 8.1.0

#50
Say what you want about PHP, but here we are decades later. I'm still using it, it still works, and it's still getting updated and improved.
Post reply on HN