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."<p>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.<p>Here is the one features that is taken for granted in "modern stacks":<p>Edit file -> Alt+tab ctrl+R. Oops, Alt+tab fix -> Alt+tab ctrl+R.<p>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.
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.<p>And by things I don't mean just web development.<p>The current limitations I see in PHP is that there is not an official multi-core coroutines solution.
I use C#, Javascript and PHP a lot.<p>PHP always wins when it comes to deployment and productivity. In my opinion that's the power of PHP.<p>It's also versatile. I used it for small projects, multi-million € projects, COM-port communication, API communication, prototyping and what not.<p>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.
Fibers "allow blocking and non-blocking implementations to share the same API"<p>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 <a href="https://github.com/python-trio/unasync" rel="nofollow">https://github.com/python-trio/unasync</a> which can code-generate the non-async version of a library from the async version.
PHP has a lot of warts, and I mean <i>a lot</i>, 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.
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.<p>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.<p>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.<p>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.
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.
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?
Question: does class_exists still return TRUE when given the QCN to an enum?<p>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.
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.<p>I believe we are a few steps away from a fully builtin production ready server and db connection support.
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.<p>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.<p>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.
Reading some comments here and it does confuse me<p>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<p>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<p>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<p>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?<p>Writing this out ease my mind a bit yea, need to be able to communicate the confusion instead of just saying "programming is difficult"<p>[0]: <a href="https://news.ycombinator.com/item?id=29343773" rel="nofollow">https://news.ycombinator.com/item?id=29343773</a><p>[1]: <a href="https://news.ycombinator.com/item?id=29344427" rel="nofollow">https://news.ycombinator.com/item?id=29344427</a><p>[2]: <a href="https://news.ycombinator.com/item?id=29344704" rel="nofollow">https://news.ycombinator.com/item?id=29344704</a><p>[3]: <a href="https://news.ycombinator.com/item?id=29345986" rel="nofollow">https://news.ycombinator.com/item?id=29345986</a>
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.<p>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.<p>Enums are neat, though.
What is this?<p><pre><code> 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 = '';
}</code></pre>