StackOverflow has been trying to address that problem. I've recently seen them show a newer answer on top of the "accepted" answer even though it had fewer votes. This helps the answer evolve over time.
But that’s not the problem.
The problem is that the questions are old.
It’s better to have the same question in a new era. The version info should be in the question. The question has either been answered or not, but it’s not relevant anymore for the original poster.
Only if it really is, you could add a new major version to it to indicate compatibility
I'm not sure I see the distinction. I've needed help doing "X", I googled "how to do X", and found ancient stackoverflow questions. The page has recent answers ranked the highest saying things like: "in recent years you should use the Y feature to do X". I haven't seen anyone get upset that the Y feature didn't exist when the question was posted.
Questions are often timeless. The answers change and SO shows them all with their timestamps ordered by its best guess at which will help you, the reader, not the original poster.
that's very true. But it is true for PHP as it is for any other language or tech that is at least a decade old.
Interesting fact: chatgpt can recognize old stuff and give better recommendations
Still, somehow it’s more true for php.. maybe because other languages invest more in migrating to newer standards. Maybe because so many projects are self-hosted by non-programmers, in which case it makes sense to be conservative
Can you name one or two "newer standards" that "other languages" have invested more in migrating to, compared to PHP?
Did you mean standard, as in HTML5 or ES6? Or something more like a fashion or fad, like FP or OOP (which PHP has had for a long time)?
People ask the same old questions about PHP on StackOverflow et al. because a lot of people start with PHP and as beginners they will have the same questions every beginner had before them, and the same lack of ability figuring things out themselves or finding their questions already answered. That has nothing to do with PHP per se except that PHP offers a very easy on-ramp to getting started with web development, so a lot of newbs start there.
If you look at the W3Techs methodology, posted on their site for all to see but apparently few to bother with, you will see that self-hosted hobbyist and learning projects aren't going to make it into their results.
People googling for solutions will get 30+ year old "advise" on how to do certain things / use certain libraries etc.
Especially StackOverflow should be incorporating a major version number for which the question is valid.
So yes, "PHP is still dead" as long as you get the same old advise.