We are not in the early days though, and in many other aspects PHP evolved greatly.
We are not in the early days though, and in many other aspects PHP evolved greatly.
If we want to change the param order of str/array functions for php, I think we should start with fixing the C libraries. That seems like a better starting point. The impact will certainly be more beneficial to even more developers than just php.
The fact that they are chaotic since 30 years ago is not a valid reason for keeping them chaotic right now.
Also, I'm not even arguing they should change the existing functions, that would break all existing code for almost no reason.
I think they should "simply" support methods on primitives, and implement the main ones in a chainable way:
"test string"->trim()->upper()->limit(100);
[0,1,2]->filter(fn ($n) => $n % 2 === 0)->map(fn($n) => $n * 2);
I would love this so much