Source.

Yep, PHP is turning 30 this year! Wondering if “PHP is still relevant?” Ever since we have been hearing that PHP is dead. It was “dead” 10 years ago, 5 years ago, and “is dead” today. But somehow - it isn’t. Anyway… happy birthday!

  • Decq@lemmy.world
    link
    fedilink
    arrow-up
    83
    ·
    edit-2
    11 days ago

    Let’s be honest though. The early PHP versions were absolute dog shit. And the definition of how not to design a programming language. That said, that never stopped anyone in web development from using it apparently. No clue what modern PHP looks like, apparently it’s better now.

    • kingofras@lemmy.world
      link
      fedilink
      arrow-up
      53
      ·
      11 days ago

      Was not intended as programming language. The name literally stands for Hypertext PreProcessor. It was meant to be a script injector for HTML back when the internet was still fun.

      Then it got out of hand and PHP didn’t evolve fast enough to be a web technology leader, but never ceded the position of old trusty workhorse, and still powers a significant part of websites.

      • Decq@lemmy.world
        link
        fedilink
        arrow-up
        20
        ·
        11 days ago

        I somewhat know the history of PHP and how it came to be. And that it was just a personal project that suddenly got big. So I don’t blame the creator. But that still doesn’t make it a good language.

    • thesystemisdown@lemmy.world
      link
      fedilink
      English
      arrow-up
      18
      arrow-down
      1
      ·
      11 days ago

      Modern PHP is better because it’s modern. Which early version of a programming language was good? I’ve used a lot of them, and by modern standards, I think dog shit is a somewhat appropriate description for most of them.

      • azertyfun@sh.itjust.works
        link
        fedilink
        arrow-up
        14
        arrow-down
        1
        ·
        11 days ago

        It’s one of a plethora of scripting languages from the '90s which were designed to be the antithesis of “fail fast” and kept going no matter what.

        I guess what with C/C++ being the Mainstream Option at the time, not having to deal with a strict compiler must have felt like freedom. As someone who has had to maintain, cleanup and migrate ancient PHP code, I call it folly. That mindset of “let the programmer just do whatever and keep trucking” breeds awful programming practices and renders static analysis varying degrees of useless, which makes large-scale refactoring hard to automate which is just amazing when your major versions aren’t even remotely FUCKING BACKWARDS COMPATIBLE.

        PHP’s original design is just fundamentally atrocious. It became popular in large part because unmaintainable code is usually someone else’s problem.

        A language that I would definitely use for server-side rendering and that was already good from its first stable release is Go. It was thoughtfully designed and lends itself really well to static analysis, while still being easy to write and decently performant.

      • Decq@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        11 days ago

        It’s been about 20 years since I’ve touched PHP. So i don’t remember all the problems i had with it.

        But some language from those times were at least consistent with itself and clearly more thought-out. Even though they might miss some of the nicety we’ve come to like nowadays. Of course for web development there weren’t many better choices back then.

        But I’m heavily skewed towards non-oo, static typed, explicit languages so PHP was probably never for me.

        • Early Swift was very slow to compile and start. The debugger was nonfunctional.

          Otherwise it was pretty usable. Especially since it got to leverage the huge libraries written for Objective-C.

          Which meant it lacked some basic collection types. A Swift native Set was introduced with Swift 3 IIRC. Before that you had to bridge back and forth between Swift and Objective-C. Sometimes leading to unexpected behavior at runtime.

          In Objective-C if an object reference was nil, you could send it messages (call methods) without a problem. Swift however did away with this. Optionals had to be explicitly unwrapped. So if the annotations weren’t correct, Swift code would crash at runtime where Objective-C would have been fine. Lots of bugs related to that existed.

          Swift peaked around version 4. Since then, they have been adding kitchen sink features and lots of complexity to feel smart.

          I still would have preferred an Objective-C 3.0. Chris Lattner was a C++ guy and never really understood Objective-C culture and strengths.

    • friend_of_satan@lemmy.world
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      11 days ago

      IMHO the killer feature was mod_php. Writing server-side website logic was stupid easy with that. I think if it weren’t for that, php wouldn’t have been nearly as popular.

      I quit using it like 10 years ago, but I’m happy with what I did with it and got from it.

    • nilloc@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      5
      ·
      11 days ago

      When I was using Ruby (some Rails, but mostly Sinatra, for little web apps and api serving) Laravel was coming up in PHP shops. Which was just trying to be Rails running on PHP from what I could tell.

      There were others before that, like CakePHP, but all I remember about that of all the bugs my coworkers dealt with. I was strictly a front end dev back then.

  • BlameTheAntifa@lemmy.world
    link
    fedilink
    arrow-up
    66
    ·
    11 days ago

    In PHPs defense, it keeps evolving in positive, meaningful ways. If you are up to date with it, it’s quite sophisticated and enjoyable. Doubly so if you use a framework like Laravel.

    • mriswith@lemmy.world
      link
      fedilink
      English
      arrow-up
      16
      ·
      edit-2
      11 days ago

      Most memes or jokes referencing a direct problem in PHP, are old or made by people who haven’t touched the language in a decade(version 7 was in 2015, and it removed/fixed a lot of issues and added needed features).

      There’s also the huge looming thing that a lot of programmers forget: Websites like Wikipedia run on PHP, not to mention the amount of WordPress and similar websites are out there. Which means it will keep going strong. And for a while Facebook also used quite a lot of it, to the point where they made a rudimentary compiler instead of rewriting parts in more efficient languanges.

    • Lovable Sidekick@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      11 days ago

      I agree. A lot of people who mock PHP know almost nothing about it but they know they’re supposed to hate it because all the cool kids do.

    • SavinDWhales@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      10 days ago

      PHP 8.4 is pretty good, TBH. You absolutely CAN write great code with modern PHP. … Shame that most PHP I touch is legacy code that’s at MOST PHP 7.4 - which is EOL since November '22 and has to be upgraded or replaced. 😬

    • mad_lentil@lemmy.ca
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 days ago

      Yeah last time I used it was with a laravel monolith and actually it wasn’t that bad.

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      3
      ·
      11 days ago

      Yeah, if you add tons of extra rules and tools, it can become almost as pleasant as the main Python or Ruby experience.

      Almost.

  • merc@sh.itjust.works
    link
    fedilink
    arrow-up
    43
    arrow-down
    1
    ·
    11 days ago

    Where I live, I still see people in a horse-drawn wagon. So, I guess horse-drawn wagons never died? It’s only used for tourists and weddings, but that counts, right?

    According to Tiobe, PHP was the programming language of the year in 2004. In 2010 it was number 3 in the top 10 programming languages. It’s now out of the top 10 entirely. There really isn’t a language that has completely disappeared. Mainframes are still programmed using COBOL, Scientists are still using FORTRAN, even Lisp, which has been around since the 1950s, is still going strong.

    Maybe Actionscript counts as truly dead, since it was tied to Adobe Flash, and Flash is truly dead?

    I have a lot of bad memories of PHP. It was, for a brief time, the main language I used, but it was so ugly and inconsistent. The only thing I loved about it, at the time, was that it wasn’t Visual Basic. As bad as PHP was, at least I wasn’t making web pages in that pile of hot garbage. But, I never felt joy writing something in PHP. At best it was a slog. At worst it was like pulling teeth.

    Just about every other language has given me moments of fun. Original Javascript was a mess, but it already contained scheme-like features. It was sold as being an interpreted version of Java, but it had features that Java wouldn’t have for at least a decade. C is a brutal and unforgiving language, but as long as you’re not working with strings, it’s great to have such low-level control over everything.

    Maybe PHP has evolved like other languages, but I still am not interested in trying it out. Everything it was good at can be done better by other languages, and those are languages that give me joy, not pain. I hope it keeps dropping in the rankings so that people aren’t exposed to it as one of their first languages.

    • kameecoding@lemmy.world
      link
      fedilink
      arrow-up
      13
      ·
      edit-2
      11 days ago

      Yeah, I think this is a more fitting meme to be about Java, because despite all the java is dead articles it’s still like one of the top most used language, if anything is a serious backend service it likely runs on Java.

      • merc@sh.itjust.works
        link
        fedilink
        arrow-up
        7
        ·
        11 days ago

        Java is a better fit. It hasn’t fallen in popularity the way PHP has. But, I’m not convinced that serious backend services mostly use Java. It’s one of the languages used, sure. But, I don’t know if it beats C/C++ or Go. Apache’s C. Nginx is C. Kubernetes is Go. Docker is Go.

        I think Java has a niche with certain kinds of business logic applications, and those are pretty common. I would guess that in a typical set of interactions with a Google product, or a Meta product, or an AWS product, some parts of the traffic will be handled by services written in Java. But, others will be C/C++ or Go. There will probably also be some parts of the process that are PHP or Ruby or Python, and a lot of Javascript.

        • Java has been running serious server software since the mid 1990s. Think WebObjects running on Solaris. Lots of business stuff with big databases still run infrastructure like that.

          Java still has the big advantage of being machine agnostic. No need to recompile for ARM or Intel.

        • kameecoding@lemmy.world
          link
          fedilink
          arrow-up
          8
          ·
          11 days ago

          I can only speak for what I see in the central European market, big banks like Unicredit (literally primefaces frontend), Erste group is running Java, basically all government services are Java.

          Java is by far the dominant language on the job market in terms of number of open positions and salary.

    • PumaStoleMyBluff@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      11 days ago

      There are still Amish and Mennonite communities who use horse-drawn wagons and farm implements their whole lives.

      Not really meant to be an argument to your point, just interesting to know.

    • ByteOnBikes@discuss.online
      link
      fedilink
      arrow-up
      6
      ·
      11 days ago

      Laravel brought life back to PHP for me. It’s elegant. I feels like speaking.

      And PHP 8 is light-years away from the garbage I grew up on.

      • merc@sh.itjust.works
        link
        fedilink
        arrow-up
        8
        arrow-down
        5
        ·
        11 days ago

        I took a look and threw up in my mouth a little. That’s not how backslashes should be used.

        Instead of writing their frontend templates in PHP via Blade, many developers have begun to prefer to write their templates using React or Vue.

        So… the only thing that PHP is really good for should be replaced by React or Vue Javascript / Typescript?

        To each their own, but for me that’s a no.

        • SkaveRat@discuss.tchncs.de
          link
          fedilink
          arrow-up
          6
          arrow-down
          5
          ·
          11 days ago

          Tell me you haven’t looked at php in 15 years without telling me you haven’t looked at php in 15 years

          • merc@sh.itjust.works
            link
            fedilink
            arrow-up
            5
            arrow-down
            5
            ·
            10 days ago

            I just looked, that was the basis of my comment. It’s bad, in particular that “Laravel” thing was awful.

    • ChickenLadyLovesLife@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      1
      ·
      11 days ago

      There really isn’t a language that has completely disappeared.

      How about that shit where a “program” was a bunch of patch cables plugged into various sockets? That shit is gone, man.

      • lad@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 days ago

        Just for the sake of being contrary, I know that there are still machines running on punch cards in some army-related places, where not changing anything is mandatory. I wouldn’t be surprised if hot-wiring is also still there somewhere, it’s just mostly running without changes.

        • ChickenLadyLovesLife@lemmy.world
          link
          fedilink
          English
          arrow-up
          3
          ·
          10 days ago

          The original Moog synthesizers used patch cords (in fact that’s why a synthesizer instrument sound is still called a “patch”) and I’m sure somebody somewhere is still fucking around with one of those.

    • dlb@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      11 days ago

      I wouldn’t even say that Flash is truly dead, thanks to emulators like Ruffle. You can still make a movie or game in Flash MX 2004, which is freely available now, and have it run in the browser. That said, last I looked (years ago) only AS2 was supported, so AS3 might be well and truly dead (rip my first language).

  • ursakhiin@beehaw.org
    link
    fedilink
    arrow-up
    23
    ·
    10 days ago

    PHP will never die. As long as code is written there will be PHP developers there to claim it’s good now.

  • TomMasz@piefed.social
    link
    fedilink
    English
    arrow-up
    32
    arrow-down
    10
    ·
    11 days ago

    It’s old and ugly, the worst tool you can use for anything, and unkillable.

  • SpaceNoodle@lemmy.world
    link
    fedilink
    arrow-up
    20
    ·
    11 days ago

    Replaced the P in LAMP with Python when I started building webpages again a few years ago, and never looked back. Such a vastly more pleasant experience.

    • petersr@lemmy.world
      link
      fedilink
      arrow-up
      10
      arrow-down
      2
      ·
      11 days ago

      I am an advocate for LKPPR (Linux, Kubernetes, Postgres, Python, React). Doesn’t roll off the tongue that well.

        • petersr@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          11 days ago

          What’s your alternative for web development?

          Server side rendered content can only get you so far.

          • Bilb!@lemmy.ml
            link
            fedilink
            English
            arrow-up
            3
            ·
            edit-2
            11 days ago

            Webassembly frameworks.

            Blazor! But only because I’m a dotnet guy professionally.

            Yew? I’m not good enough with Rust to have tried it.

            • PolarKraken@programming.dev
              link
              fedilink
              English
              arrow-up
              1
              ·
              10 days ago

              Dotnet professionally and using lemmy.ml socially is hilarious to me and (sincerely) entirely consistent. Makes perfect sense, I just find it funny. (I’m not being sarcastic or attacking you, might not be clear lol)

              • lad@programming.dev
                link
                fedilink
                English
                arrow-up
                2
                ·
                10 days ago

                I’ve toyed with WASM, creating a simple sudoku page, and it did take an empty page, added all the buttons, and then changed them upon user interaction.

                I think, I also heard of the DOM modification limitations, but it’s not a hard barrier afaik, there are just some cases where it can’t

                But still, doing something in (pure) WASM looks way harder than needed to me

          • Billegh@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            11 days ago

            Right? That’s the mindset that brought us asp, jsp, and php. JS might be obnoxious, but it’s the only viable client-side right now.

    • rumba@lemmy.zip
      link
      fedilink
      English
      arrow-up
      4
      ·
      11 days ago

      Python is a natural evolution for web development, especially once you’re past the fundamentals. For someone with no scripting background, PHP is easier to approach. The syntax is more direct, and basic debugging doesn’t require any setup. An error happened on x line is the default behavior.

      Python’s logging system can be tricky to configure properly if you’re unfamiliar with the factory and error level handling. Those green people don’t have any idea where to put the log or how to let the web server talk to it safely.

      It’s the little bs like refusing for years to include switch, then when they finally give, they just refuse to allow fallthrough. It’s like they said, fine, but it’s got to work slightly differently and we don’t like the name… it feels childish.

      All things considered, Python has a richer ecosystem and deeper long-term potential. But there’s something to be said for how quickly a basic PHP site can be spun up and debugged with minimal knowledge with minimal friction. And that’s why it’s still around so much today.

      • SpaceNoodle@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        11 days ago

        I agree that PHP was easy to pick up, but I already knew several programming languages and was quickly shooting myself in the foot with the extremely overbuilt, redundant, and buggy builtin functions. At the time, though, it was either that or ASP, so I chose the lesser of two evils.

        To segue, switch statements aren’t inherently necessary for a mature programming language; I think that addition was partially to mollify the growing userbase (not a good reason), but on the other hand it’s really just structured pattern matching wearing a hat that says “switch” on it … though again, that’s something which could fairly trivially be achieved with a list comprehension. It’s not like you’re getting the machine-code-level optimizations that a C compiler could churn out for a proper switch statement.

        • rumba@lemmy.zip
          link
          fedilink
          English
          arrow-up
          3
          ·
          11 days ago

          I personally feel that giving the growing user base things they want is probably the most prudent reason. Constantly refusing to provide simple constructs that are available everywhere else It’s not a good look. In the open source world if you do that shit enough you end up getting forked.

          The context and ease of switch in a functional programming layout is a rather clean implementation.

          Otherwise you end up with the crap like they’re pulling with flask were you just make an unnamed, unindexed number of functions. Can you sort and organize your functions and make everything clean? Sure you can. Does it happen by default? Almost never.

          You can walk up to someone else’s switch and see what the options are. The code flows through that simple construct and it’s very easy to understand someone else’s work.

          I load up someone else’s flask endpoint, It’s just this multi-page stream of consciousness.

          You don’t need switch, But there’s a reason why so damn many people ask for it. Before they agreed to include “match”, They said just to use getattr and write your own switch.

          • PolarKraken@programming.dev
            link
            fedilink
            English
            arrow-up
            3
            ·
            10 days ago

            I think I agree with you, and I also think you probably know better than me, but - Python couldn’t become what Python became without doing this exact thing very deliberately, bordering on obnoxious at times. Fundamentals or “initial state” define the characteristic strengths and weaknesses for a language, but what to add and what not to, as well as “why” and “how”, over time determine the true shape and user experience (lacking a better word there) of a language.

            Despite its reputation, in my view Python has always been far more opinionated about how to do things than most give it credit for.

            • rumba@lemmy.zip
              link
              fedilink
              English
              arrow-up
              2
              ·
              10 days ago

              Yeah, I don’t take exception with most of their choices, and to be perfectly honest PHP has historically made a number of really bad choices and refused to fix horrible bugs.

              I just feel that providing the handful of tools that have been available since C and keeping them with the same name and the same argument position only makes sense.

              If people aren’t cloning Python commands for their design sensibilities. When they ask for a creature comfort that doesn’t affect performance, It should be more strongly considered.

    • Lovable Sidekick@lemmy.world
      link
      fedilink
      English
      arrow-up
      15
      ·
      11 days ago

      Or TSP (trisodium phosphate) - which you can’t even make websites with, but it’s great for cleaning oil spots off the driveway.

      • Lenggo@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        11 days ago

        I laughed pretty hard at this while also unexpectedly learning how to clean up a mess I made changing the oil in my car on a particularly windy day recently!

      • PolarKraken@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        10 days ago

        Well, now, that’s useful, but we shouldn’t fail to mention good ol HCl, muriatic acid colloquially for this purpose, also great for cleaning oil stains from a driveway!

  • paulbg@programming.dev
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    11 days ago

    bro ive been doing fullstack js dev for severals years to then realize php is superior💀

      • PolarKraken@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        ·
        10 days ago

        Happens a lot - my (quite small) shop was using NestJS for backends and my boss is way more experienced and wise than me. I unintentionally caused us to switch over to Python, which probably sounds as silly as JS to many, but - we deliver dope shit, on time and on budget 🤷‍♂️

      • percent@infosec.pub
        link
        fedilink
        arrow-up
        4
        ·
        11 days ago

        Thanks to web browser development, there has been quite a lot of focus/investment into JS runtime optimizations. Since the server-side runtime environments use those same JS engines, performance tends to be quite good.

  • simonced@lemmy.ml
    link
    fedilink
    English
    arrow-up
    13
    ·
    10 days ago

    Array_filter and array_map having the arguments swapped pisses me of so much.!