AegirLeet
3d ago
334
272
firefoxd
I've been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying "PHP has come a long way. It's a proper language now, etc."

If you work long enough with a language and figure out most its quirks, it's a breeze. It's nice that they are adding all these new features, but they are hardly what makes it or break it for me.

Here is the one features that is taken for granted in "modern stacks":

Edit file -> Alt+tab ctrl+R. Oops, Alt+tab fix -> Alt+tab ctrl+R.

When debugging I can do that 50 times a minute. With my react app, I can do it maybe 5 times a minute. With my golang app I'm lucky if I can do it twice a minute.

pachico
Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things.

And by things I don't mean just web development.

The current limitations I see in PHP is that there is not an official multi-core coroutines solution.

tdrdt
I use C#, Javascript and PHP a lot.

PHP always wins when it comes to deployment and productivity. In my opinion that's the power of PHP.

It's also versatile. I used it for small projects, multi-million € projects, COM-port communication, API communication, prototyping and what not.

The syntax is not great, but to me PHP is this multi-tool that just gets the job done and will run reliable for years.

laacz
Judging from the comments, it looks that many negations stem from the "old PHP". I've been developing with PHP since late 90s. Oh, boy, I've created a lot of bad code during all those years. However, when doing new year's retro, there has not been a single time I would be able to say that PHP has not evolved. As well as my code.

Modern PHP might not have all the shiny features other high profile languages have, but it's getting there. It's slower than many would like because of much debt and legacy. But it'll get there.

Also, you can write shitty code in any language. I would bet that, if back then python was as easy to deploy, as PHP, we'd now be fighting about that the same way as we are about PHP.

jdjdjrj
Say what you want about PHP, but here we are decades later. I'm still using it, it still works, and it's still getting updated and improved.
simonw
Fibers "allow blocking and non-blocking implementations to share the same API"

That's an interesting contrast to Python where the need to use "value = await fn()" v.s. "value = fn()" depending on whether or not that function is awaitable causes all kinds of API design complexity, all the way up to the existence of tools like https://github.com/python-trio/unasync which can code-generate the non-async version of a library from the async version.

josephcsible
PHP has a lot of warts, and I mean a lot, but one thing I really like about PHP that virtually no other Web languages offer is that I can just drop code in my Web server's document root, go to that path in my browser, and it runs, without needing to deal with frameworks, boilerplate, compiling, etc.
shruubi
As someone who has worked in a lot of languages and now works in PHP, I think that while PHP still has some of the same warts it did in the old days, I am also understanding that given PHP is, for better or worse, a fundamental piece of web infrastructure, and that providing an upgrade path while also ensuring that they don't just break a large chunk of the web is less a matter of "software conservatism" and more a responsibility of the dev team.

And, if we're being honest, the reality is that for that chunk that would break, most of them would either not have a developer on hand to fix it, or would be what I call a "Wordpress cowboy" who has a WP site they set up five years ago that they never update, and the sum total of their development experience is installing various WP plugins until the site vaguely does what they want it to do.

It's hard, because on one hand, if we didn't have things like Wordpress, then PHP would be in a position to undertake more breaking changes that would overall give the language and its libraries the much needed quality improvements. On the other hand, without things like Wordpress, it does become somewhat questionable as to whether PHP would have survived the dark days of PHP4 and the early versions of PHP5.

In saying all that, the work that the dev team have done to add great features and solid performance, alongside the community which has done a lot of good things like PSR's and the PHP League libraries to me, is one of the key things that makes PHP still an attractive environment to work in.

bilal4hmed
I haven't written PHP since the 5.0 release but its amazing to see how it has grown over the years. Seems to have picked up a few nice things and is still enjoying usage even today.
rbanffy
Genuinely curious: who here thinks PHP is a good choice for a new project and also has experience with other languages such as Scala, Kotlin, Python, or JavaScript and their respective web frameworks?
pdenton
Question: does class_exists still return TRUE when given the QCN to an enum?

Because it's not possible to instantiate an enum, if one appears in the constructor of a class it'll break auto-wiring. I've written my own IoC containers and one fundamental assumption in them is that when class_exists returns true, it is what it says on the tin. Using a specialized factory would still be possible. I wonder if other containers would break on seeing enums as well, but I hope they fixed this because it's not mentioned in the breaking changes. The documentation for class_exists doesn't mention enum.

maxpert
Fibers!!! Who wants to bet we are a few releases away from async/await syntax now. Giving credit where it’s due Microsoft with C# pioneered the syntax and every classic (including a few modern) language has adopted the syntax.

I believe we are a few steps away from a fully builtin production ready server and db connection support.

marcodiego
Still holding the web. Happy to see it is continually evolving.
VMtest
Reading some comments here and it does confuse me

Promises, async and await in javascript, coroutines and threads in kotlin, fibers in some language runtime (including this php 8.1 [0]), single process (nodejs), multi-process(php-fpm worker), single-thread, multi-thread, goroutines in go, multi-core coroutines

Googling the definitions and x vs y situation helps a little, the main confusion to me is why some people want this xyz feature in a language runtime and not the other, the pros and cons are seriously so confusing

I have probably used several, like promises, async, await, like others said async would be implement on fibers [1] (is php 8.1 implementation same as V8,spidermonkey,javascriptcore? or any other language runtime). And I have tried to understand kotlin coroutines as well

modern times to run php, people would use php-fpm with nginx, it is running multiple worker (single) process, so why would anyone [2], [3] wants multi-core coroutines in it? What does it even mean?

Writing this out ease my mind a bit yea, need to be able to communicate the confusion instead of just saying "programming is difficult"

[0]: https://news.ycombinator.com/item?id=29343773

[1]: https://news.ycombinator.com/item?id=29344427

[2]: https://news.ycombinator.com/item?id=29344704

[3]: https://news.ycombinator.com/item?id=29345986

tarokun-io
I haven't written PHP in years but I get the feeling from this release that they are taking inspiration from TypeScript and JavaScript.
fart32
I sometimes wish I'd never learnt C#. I love property accessors, as I consider properties to be a part of public API and in PHP, there's no nice way around it other than the boilerplate getters and setters.

Also I hope we'll get generics at some point. I know there are some issues with their implementation, but even non-runtime enforced generics would be better then relying on a docBlock annotation.

Enums are neat, though.

EGreg
What is this?

  class User 
  {
    /**
     * @Assert\All({
     *     @Assert\NotNull,
     *     @Assert\Length(min=5)
     * })
     */
    public string $name = '';
  }
  PHP 8.1
  class User 
  {
    #[\Assert\All(
        new \Assert\NotNull,
        new \Assert\Length(min: 6))
    ]
    public string $name = '';
  }
ittan
Excuse my intrigue. Is this topic biased to language design or experience using php?
briimannen
Still no unicode support? LOL! How about starting there and stop with trying to make PHP into some weird Java clone.
lifeplusplus
PHP devs make less and have to learn JS anyways.
s-xyz
Who is still using PHP anno 2021?