1. 31
  1.  

  2. 16

    I’m glad to see this post.

    I don’t get why people keep bashing PHP so hard. Yes it’s a flawed language, but so is every other language.

    PHP shines at shipping stuff quickly. It’s a pity it gets so much flak.

    1. 32

      Yes it’s a flawed language, but so is every other language.

      No. This both-side-ism has to stop. Not all languages are equal. Some flaws are bigger than others.

      1. 15

        Because PHP has got more wrong than other languages by not even trying.

        It’s funny that, like Java, it is only recognising its faults as faults when its fortunes have changed.

        1. 5

          PHP shines at shipping stuff quickly.

          The downside of this is that it can lead to unimaginable hairballs: a single file that interleaves view, logic, and data models. The standard libraries and the language itself had warts aplenty and actually encouraged obscene coupling and unsafe practices (mysql_escape_string and m_real_e_s I’m looking at you)

          While things have gotten way better - I’ve seen a modern PHP code base at work and it looks rather nice - people have long memories.

          1. 5

            A good chunk of the issues in early libs/functions, is that they’re very thin veneer over the C counterpart. That isn’t an excuse, but it’s the reason. Weird behaviour with Null bytes in your strings? Because that’s how C terminates strings. Weird naming? Most times it’s likely because of the underlying C function naming.

            The good news is, as you’ve both mentioned (and the article too), things are improving at a rapid pace. Some parts seem impossible to remove because of B/C. But remember, the mysql extension was removed from core.

            1. 4

              The downside of this is that it can lead to unimaginable hairballs: a single file that interleaves view, logic, and data models.

              So can every language.

              PHP has great frameworks that will totally prevent that from happening. A “better” language does not trump bad practices.

              I agree with you on the stdlib part though, even though that sort of stuff happens in every language to varying degrees

            2. 4

              I was a long time PHP hater. I still have nightmares from the PHP 4 era.

              Recently I’ve been looking into PHP 7 and 8 and I must admit it has gotten so much better! I like the gradual typing effort. I love the community support for static analysis tools like PHP CS, Phan, etc. Add Composer and IDE’s like PhpStorm/VSCode to the tooling story, and you have a pretty nice ecosystem!

              Compare that to the staggering innovation (sarcasm warning) in the Ruby and Python space that brought us technological wonders like yield_self and the walrus operator. Both ecosystems have stayed more or less the same for the past 10 years. (Yes, I’m aware of the “ML revolution” in Python-land – I herd data and ML models with Python for a living.)

              1. 3

                In ruby-land we got bundler, performance fixes & the beginnings of basic typing support, which were the only things I really wanted. It’s nice to no longer be stuck running “Ram Use Beyond Y-axis”.

                1. 2

                  I generally prefer not to be staggered by the innovations in my language ecosystem… that leads to things like Python 3 or Perl 6 where you slowly and painfully (if ever) get widespread adoption, and spend lots of engineering effort just to stay afloat.

                  Also, the need for a bunch of staggering innovation tends to be an indication that you did things wrong to start with. Don’t get me wrong, it’s better to fix it than not, but I wouldn’t necessarily consider that a strong positive indicator in a mature language.

                  1. 2

                    PHP 7 and 8 are okay. It’s basically just Java 7 without generics. But that’s workable. You can use Phan/PHPstan/whatever, but they make the code hideous, IMO. It’s, of course, worth it if you like static typing and have to use PHP. But if you like static typing and don’t have to use PHP, well…

                2. 3

                  PHP is great! Glad that I learned it early in my life. Easy to learn, fast to deploy and easy to debug.