Closed longshadowdev closed 2 years ago
It's been discussed on the internals mailing list in a couple forms, not necessarily recently. https://www.php.net/mailing-lists.php
Autoboxing seems to be the most viable solution proposed so far. https://www.geeksforgeeks.org/autoboxing-unboxing-java/ https://wiki.php.net/rfc/autoboxing
Description
I'm not sure if this has been brought up before. It seems very obvious so probably has, in which case please point me to previous discussion and let me know if it's something that would be 'rejected' if I contributed it myself.
PHP has come a long way to be object orientated, but we still rely on very outdated procedural function calls for String, Array, Integer (etc) manipulation.
If we wanted to avoid having optional object orientated objects, we could at least have static classes?
For example instead of str_contains (a new function in php8 with legacy conventions) why not have String::contains()?
Then backport all of the similar functions into methods of this new class, and maybe eventually in a later version of php make the legacy functions optional as a compile time or runtime flag.