• Arthur Besse@lemmy.ml
    link
    fedilink
    arrow-up
    37
    ·
    edit-2
    1 year ago

    This is an irritating meme.

    Were people saying PHP was dead in 1995, the year it was released? I guess maybe?

    But who was suggesting abandoning PHP for Django in 2003, two years before the latter was publicly released? I suppose the person who made this must’ve read that Django development started in 2003 and gone with that; most of these years correspond with when the respective project started.

    So, the reason Perl (which remained more popular for web development than PHP or any of these things into the early 2000s) isn’t on the list must be because it actually predates PHP.

    But then what is up with Python in 2022?

    • paholg@lemm.ee
      link
      fedilink
      English
      arrow-up
      30
      ·
      1 year ago

      I also appreciate that you’re supposed to learn Django 19 years before you learn Python.

    • catacomb@beehaw.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Yeah, plus PHP was very popular circa 2011-2016 and laravel was loved by many around that time and beyond. It’s always been a useful language.

  • vsis@feddit.cl
    link
    fedilink
    English
    arrow-up
    12
    ·
    1 year ago

    There are two kind of programming languages:

    1. The ones everyone complaints about
    2. The ones nobody uses.
  • mrbubblesort@kbin.social
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    1 year ago

    People who say PHP is shit haven’t really used it and are just repeating the memes. It’s a perfectly fine language and there are a number of excellent tools and frameworks for it. It’s reputation is a result of it’s easy entry and widespread use. A whole lot of people who knew just enough to be dangerous made a whole lot of stuff, and it ended up causing a whole lot of problems. But for some reason devs shit on the language instead of shitting on the devs who put them in a mess.

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      1 year ago

      Nah, it’s historically been a special kind of shit. It started life as a Perl templating engine, then grew out to its own language where it repeated all of Perl’s mistakes while adding more of its own. Its community was single-handedly responsible for keeping SQL injection attacks in the OWASP Top 10 list for years. Notice that it’s now bundled with “injection attacks” as a generic label for a wider range of similar issues–SQL injection alone would no longer warrant being there. Its conflation of arrays and hash maps meant it took years to wrestle with algorithmic complexity attacks. Perl kept the two separate, and was able to get a patch out for algorithmic complexity almost immediately (though it turned out to have a few bugs of its own, and a true fix came in a few years later; still faster than PHP solved it).

      The web from 1998 through 2010 or so was absolutely riddled with bad PHP programs. “But that’s not the language’s fault”, you say? Doesn’t matter. Community is an important and underappreciated feature of a language, and PHP had a special kind of shit community. It almost seemed designed to suck away the dross from all other communities.

      Consider the plugin system for phpBB:

      • Its architecture doesn’t have any kind of hook system for plugins; they’re added by patching the code in place
      • This naturally leads to different plugins interfering with each other
      • Having done that, you might choose one of the patch formats already out there, but phpBB decide to create their own
      • There are, at first, no tools available to automatically patch in plugins, so administrators (often not developers themselves) need to hand edit the source files and modify the database (the plugin format specifies both together)
      • Tools start to emerge over the years to handle it automatically, but they’re buggy and unusable for a long time

      Is it PHP’s fault that one major application was implemented so poorly? YES! Its community is a feature, and its community is what brought us to this.

      You want to claim that the language has done better since PHP7? Alright, that’s fine. I still don’t care. There are so many better options available, and I don’t have time to keep up with all of them. I’m happy relegating PHP to being a long-tail language where it trails off slowly over the years like COBOL.

      • araozu@lemm.ee
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        I’d say that PHP allows you to write very bad code (and makes that the default). It’s a language feature.

        For example Java has a lot of NullPointerException because it was designed with null and without mechanisms to detect & prevent these errors. Any method can return null and cause a NPE. It’s just easy to ignore them. Modern languages like Go, Rust or Zig force you to handle null errors, and make it easy to do so. NPEs are a lasguage feature in Java.

        In the same way PHP allows you to write any ugly code you want. There are no checks, no safety. People can write bad code, people can be lazy, people can be stupid. PHP allows it and empowers them.

      • catacomb@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Exactly. I used PHP for years, I haven’t “not used it.” It was the first programming language I seriously learned. Writing good code was tedious if not impossible and that became even more obvious as I expanded to C#, Java, Python and C++; none of which tolerated any of the bad and unconventional practices I’d inevitably picked up. Keep in mind, I was actively trying to avoid bad practices and pay close attention to types but still got kicked to the curb hard when I tried other languages. I haven’t had that since.

        I appreciate it’s changed since, I’m happy to see it’s not the same dumpster fire it once was, I also don’t care. I don’t actively trash it, I just think there’s usually a better option.

    • Blackmist@feddit.uk
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      I think the worst thing about PHP is all the ancient tutorials that litter the web like landmines. SQL injections everywhere.

      And there’s way too many low-budget wannabe web developers who know just enough to blow their own feet off. Or more likely whoever paid for its feet, because that web dev will be nowhere to be seen a week after handing it over.

    • araozu@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      I used to think that php was a bad language until recently (used php5 when i was just learning to program, cooked some delicious spaghetti). But after 5 years I had to use PHP at work. The language has improved a lot, but I think a lot of the bad parts are still there.

      Like, why does stdclass exist? Why not just use associative arrays? Why are there warning, error, fatal errors, exceptions? Some functions throw exceptions, other raise errors, others return false, other fail silently and you have to call another function to check if there was an error (last_json_error). Why do find functions return false instead of -1? Like every other language? Why can’t I use strings with numeric values as maps keys? (I can’t have ["001" => value], it gets casted to ["1" => value].

      There are no generics, you have to use mixed everywhere. The stdlib is an inconsistent mess, some_snake_case, someCamelCase, verb_noun, noun_verb, functions are not namespaced, everything is global. A lot of duplicates: die vs exit, print vs echo, etc. You are forced to use PSR & autoload to be able to use namespaces in a tolerable way, not including_once everywhere. No UTF-8 support, only ascii. You have to manually use mb_ functions. Variable scoping is weird. Variable variables? Why?

      And all that is just comparing it to the average language. If compared to a modern language like Rust, Zig, Swift, php is light years behind.

      It’s not hot garbage, but I wouldn’t call it “good”. There’s laravel, but not much more. PHP still makes you shoot yourself in the foot by default, unless you spend a lot of time learning its edge cases. Just like javascript.

    • Bigworsh@discuss.tchncs.de
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      1 year ago

      I used PHP for the past year. And honestly I still think it is not a good language. Just of the top of my head.

      1. By far the biggest culprit. Arrays. This monstrosity is basically everything. Yes, it is fast but it only teaches bad habits. It is a weird combination of Arrays/Lists/(Dictionary/Hashmap) and you can’t know which one it currently is because there are 0 compile time safety checks. Also when used as a parameter it is passing a full copy instead. But the copy of course is only shallow. I have seen so many problems with that. And even worse when someone thinks the way to fix it, is to just json encode/decode the whole thing in order to get a deep copy before passing it.

      2. Generics. I still don’t get why this is such a huge issue. Like I would rather have a half-baked optional compile time implementation then none at all. The worst part is that IDE tools support generics so you end up inplementing them on the comment level. I shouldn’t be forced to use generics through comments.

      3. $ for variables. I know that this is just based on how the language grew. But god do I hate having to type it. It is not an easy to reach letter and just breaks my typing flow the whole time. You get used to it but still.

      4 . The default functions. Yes. You will mostly use framework provided functions or your own stuff. But you still end up in contact with them and the naming schemes are still all over the place, so it is fast to just google it then hope you accidentally stumble upon it through the IDE. And some things are still straight up missing. Like the best way to deep copy an array is json_encode into json_decode. When I saw this the first time I was sure that must be wrong. But no. That is legit the way to do it.

      Also I am stuck with PHP7 so some of my other complains seemed to be fixed in later versions. Also please don’t recommend DS for my first issue. I tried to push for it but it got vetoed because “it is too complicated for new devs”.

      • GombeenSysadmin@feddit.uk
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        The answer for the deep copy would seem to be a combination of a static recursive function to copy the array while cloning the objects inside, with setting the __clone() magic function in your objects to break the references, no? Granted it’s not a built in function, but not difficult to implement.

        • Bigworsh@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Sorry for being lazy so no sources for now. But based on my research back then. Using clone (on arrays) is actually slower then json_encode/json_decode.

          So there are some cool optimization tricks going on in the background. But that doesn’t make it any more intuitive for me.

    • Fushuan [he/him]@lemm.ee
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      It’s also funny how they mention languages and frameworks, but php is just php. No symphony or whatever people use now, php. And somehow people whlent from using frameworks in python to not using them? It makes little sense.

    • ahto@feddit.de
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      It has also improved a lot in the last years. PHP5 and especially versions older than that weren’t very good and deserved a lot of the criticism. PHP7 and onward are much better languages and don’t deserve the hate.

      • BeigeAgenda@lemmy.ca
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        I worked a lot with PHP3 and 4, they work by the “Here is a flat C style API and here’s all the functions to use.” principle, and a lot of the work was finding the needed function, and how to use it.

        I know PHP5 did a lot of redesign especially with classes, but have never used it, hope PHP5+ feels more like Pythons toolbox.

        If I should write a web application today, I would start looking at Python based frameworks: Django (I have used it before)/Flask/Etc. as I am not sure I would like to work with JavaScript, or have to re-learn PHP.

        • pingveno@kbin.social
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          A fun story about the origin of some of PHP’s first function names. The hash function in the table for function names in the interpreter was strlen(), so names were chosen to have a wide distribution of lengths.

          (source)

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      1 year ago

      Honestly, php is actually pretty fucking sweet for functional programming and metaprogramming… other languages wish they had __invoke and __get.

      I also think it has the “right” balance of library functions built in, you can do pretty much anything common and trivial with built-ins but the function list is short enough that you can comprehend most of it.

      • araozu@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        __invoke is just for making a class Callable. Java has those with functional interfaces. __get is just dynamic property resolution synax sugar. Instead of something like obj.get("property") you do obj->property.

        Instead, I would like to see ADTs, generics, pattern matching, immutability, expressions everywhere and a better stdlib. Then one could call PHP functional.

        It’s like how people say Javascript is functional. Sure, it has lambdas, anonymous functions, closures, const. But those alone don’t make it functional.

        Functional programming is very different (and at times hard). If you have the time you can check out F#, OCaml, Elixir, Erlang, Rust or Haskell (in order of difficulty imo). Those are more “pure” functional, rather than imperative/OOP with a touch of functional.

        See how things work, what features they have and don’t have. How problems are solved in these languages. I think learning about one of them can give you a different perspective on what functional means. I discovered F# one day, got curious and discovered a whole different paradigm, a new perspective on programming. And learning about functional programming really made me a better programmer, even on procedural/OOP.

    • z3bra@lemmy.sdf.org
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      1 year ago

      One could argue that people who say PHP is fine only suffer Stockholm syndrome !

  • Treczoks@lemm.ee
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Apart from Python, is anyone of the listed contenders actually still breathing?

  • thisfro@slrpnk.net
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I’m sure there are a lot of reasons why PHP is better than Python for the backend, but I created an app wirh Symfony 5 and then an app with Django 4.

    Symfony is so weird compared to Django. With Django I can just sit down and get things done. Symfony always seems to have some quirks which are mostly due to PHP (and me not knowing how to program in PHP).

    That said, PHP hosting is so much easier and cheaper, this probably is important for smaller projects.

    • SokathHisEyesOpen@lemmy.ml
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      You don’t need a framework for PHP. That’s the beauty of it, you don’t need anything. You cannot build a website with Python without a framework.

    • locuester@lemmy.zip
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      Isn’t all hosting containerized at this point? Is hosted, language specific servers still a thing?

      I’ve been out of the market for a while now and just run everything as containers on aws and gcp

      • thisfro@slrpnk.net
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        Many older projects don’t get migrated to containerized infrastructure and smaller businesses don’t want the overhead it creates to run a single app/webpage. Plain LAMP with FTP access is still the most common way to host I think (and thus the cheapest if you consider the amount of work that would need to be invested to containerize).

        • locuester@lemmy.zip
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 year ago

          Interesting. I never really realized how it was more my path changing than the entire industry.

          • thisfro@slrpnk.net
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            The industry is surely changing, but “the industry” is mostly geared towards enterprise, because it’s where the money is. But the large amount of webpages are not enterprise pages but personal blogs, small businesses etc.

  • Tarte@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    https://w3techs.com/technologies/overview/programming_language

    On the server-side PHP is used by 76.8% of all websites (a large chunk of that being WordPress). It is not going anywhere, soon. Looking at this statistics, nothing else seems to be even in the same league from a pure usage point of view.

    I have yet to see a reason why it should change. Serious question: What is the disadvantage of using the tried and tested PHP8 compared to the alternatives, if you already know PHP?

  • breakfastburrito@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 year ago

    This was nearly a decade ago. I worked at a small app company (5-10 developers) for a bit that used Ruby on Rails for our product. The product was in active development, but was available to customers so it was “done”. We were hiring a senior level dev to oversee the team and we interviewed this guy (maybe in his 40s?, a but older than most people in tech) and he said his first order of business if hired would be to refactor the entire code base to php. I don’t think he was joking. I’m not sure why he interviewed.

  • jagoan@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    Isn’t Wordpress powering like 40% of the internet? PHP isn’t going anywhere anytime soon.

    For me the weirder part of that meme is Python in 2022?

    • EnderMB@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      IMO, Ruby is a better Python than Python. It’s simpler, has a cleaner syntax, and if you want to do funky stuff metaprogramming can allow you to do cool, and sometimes unspeakable things. Python has great library support, and slowness and Rails did make Ruby unpopular for a bit, but I would love to see a Ruby resurgence that wasn’t to do with Rails, because it is truly a lovely language to use.

      Hell, I would say that in 2023, it’s easier/faster to get something set up and working in Rails than it is with frameworks like Symfony, Express, ASP.NET, etc.