On 28 May 2025 14:42:01 BST, "马正强" <a766650...@gmail.com> wrote:
> First, we could add a parameter like preserve_key_types to array
> functions such as array_keys()/array_search() to temporarily handle the
> implicit conversion issue.
This will not help. The keys are changed when they are *written* to the array,
not when they are read back out. No option to array_keys can tell you whether
the key 42 was originally set as '42', because that information is not stored
anywhere.
> Alternatively, we could introduce a new data type "Map"
Yes, I think this was suggested a couple of times on the previous thread. It
would be a useful feature, but probably not easy to implement efficiently and
integrate thoroughly into the language.
Regards,
Rowan Tommins
[IMSoP]