Live data from Hacker News

PHP 8

php.net

271–273 of 273 posts

Re: PHP 8

#271

Earlier quoted context omitted.

> It is well documented [...] Yes, it's documented, but it doesn't make it any less obnoxious. IMO the thought of implicit conversion is absolutely asinine. But, in fairness, PHP isn't the only language that does this. Python, at least, is more sane. > and drop any string after, e.g. '1eabc' becomes 1. In defense of PHP, it does yield a NOTICE if you attempt to apply certain operations to implicitly cast strings (e.g…

Yes, implicit conversion in both PHP and JS are brain damaged by today standards, but that's life with legacy cruft.

> but that's life with legacy cruft.

So true.

I can't really complain. Well, I can, and that's what I've been doing in much of this thread.

It's mostly just yelling at the sky for no good reason other than to make myself feel better at this point, if I were to be completely honest with you.

Re: PHP 8

#272
post #269

Earlier quoted context omitted.

Yes, implicit conversion in both PHP and JS are brain damaged by today standards, but that's life with legacy cruft.

Still in js "0.2" == "0.20" would always be false. My instinct would be that comparing two different strings would be false in php too. The problem for me is working with a big legacy codebase. I'd rather have php break backwards compatibility and change === to ==.

> Still in js "0.2" == "0.20" would always be false. My instinct would be that comparing two different strings would be false in php too.

Nope.

I wish I were kidding. This is where PHP diverges from JS in a way that really will surprise people coming from JS (PHP7.something):

    php > var_dump("0.2" == "0.20");
    bool(true)
> I'd rather have php break backwards compatibility and change === to ==.

I have mixed feelings on this.

On the one hand, I desperately want to agree with you, and probably for all the same reasons. On the other hand, languages like PHP with their dynamic typing system make implicit conversion almost a necessity to retain the identity operator (===) because they strive not to break "too much" (for some value of "too much").

Although, I'd imagine your argument is akin to "well, just cast it to what you expect" (e.g. `(int)$_GET['value']`), and you're right. That's how it should be done, of course.

But, as you mentioned about legacy code bases... sometimes it's not that easy.

Re: PHP 8

#273
post #229

Earlier quoted context omitted.

PHP 8 performance improvements were advertised https://www.fonow.com/Images/2020/0608/9f3a0f6a4f8f2ee.png https://www.fonow.com/Images/2020/0608/4e9d2337edd2072.png https://www.fonow.com/Images/2020/0608/70a1c6cff23f4fc.png

Oh, come on. Did you see the benchmarks? This is CPU-bound code, like multiplying numbers 100 000 times over. This has nothing to do with your typical use case. And, yeah, performance improvements are always advertised.

>This is CPU-bound code, like multiplying numbers 100 000 times over. This has nothing to do with your typical use case.

I think a lot of people missed this. It's not the usual PHP workload for usual/basic web dev.

Post reply on HN