1. 28

Splash page showing features: https://www.php.net/releases/8.0/en.php

I haven’t worked in PHP in a few years, but I did help maintain a PHP5 monstrosity for years. I absolutely hated working in PHP. But since 7 they’ve really started to fix so many of the issues (at least on paper). It’s really impressive the work they’ve done.

If you could somehow get old projects of up PHP8, I think day to day life of the devs would be alot better. Kudos!

  1.  

  2. 9
    0 == 'foobar' // false
    

    I thought I’d never see the day this would happen. It doesn’t completely get rid of the type juggling; 42 == " 42" is still true, but at least 42 == "42foo" is false now.

    1. 4

      I wonder how many applications that will break from this change alone.

      1. 3

        I don’t think it truly answers your question, but there was some work done to determine that.

        https://wiki.php.net/rfc/string_to_number_comparison#backward_incompatible_changes refers to https://github.com/php/php-src/pull/3917, which found few problems, even in an older codebase.

        I haven’t looked at the mailing list discussions for the RFC, but if there was further research into that question, I’d expect to find it there.

        1. 4
    2. 4

      I worked a lot with PHP in the 5.6 era and it was often pretty painful because of all the warts and stupid language design decisions. And they never got fixed because of backward compatibility. That’s why I’m happy to see that the list of breaking changes is very long, they addressed quite a few long-standing problems with these release. This change especially caught my eye:

      Nested ternaries now require explicit parentheses.

      They got the associativity of the ternary operator wrong before. Always requiring parentheses is a clever way to fix this problem without unknowingly breaking old code :)

      1. 4

        Now that PHP8 has match expressions and sum types, who’s going to say that ML isn’t winning? ;)

        1. 1

          I’m just sad they beat python to match expressions. I want match in my daily driver. :(

        2. 3

          I’m excited about matching, attributes, unions, and constructor promotion. I tend to write a lot of verbose boilerplate PHP for my organization and I expect these changes will help with those classes (mostly models with lots of attributes).

          1. 3

            If only 10% of the work went into fixing the unbelievable poor state of the PHP documentation.

            1. 2

              it would be interesting to see how existing frameworks would take advantages of the updated type system. Most PHP applications are written using some sort of frameworks, so ‘end of the stack’ developers do not get a ‘clean slate’ until the frameworks they rely on get updated