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!

  • SpaceNoodle@lemmy.world
    link
    fedilink
    arrow-up
    21
    ·
    2 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
      cake
      link
      fedilink
      arrow-up
      10
      arrow-down
      2
      ·
      2 days ago

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

        • petersr@lemmy.world
          cake
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          2 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
            2 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
              ·
              1 day 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
                ·
                1 day 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
            ·
            2 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
      ·
      2 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
        ·
        2 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
          ·
          2 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
            ·
            1 day 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
              ·
              22 hours 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.