Re: RFC: Stop to automatically cast numeric-string to int when using them as array-key
| From: | Vincent Langlet | Date: | Thu, 30 Dec 2021 16:53:50 +0000 |
| Subject: | Re: RFC: Stop to automatically cast numeric-string to int when using them as array-key | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116744@lists.php.net to get a copy of this message | ||
> It'd not be just a BC break, it'd be an absolutely massive BC break that
> has a potential to break a ton of code and would be extremely hard to
> detect. This is not something that should be changed in an advanced
> version of the language.
>
Would you still consider this as a massive BC break if
- The type of the key don't change anymore i.e. array_search(0, ['10' =>
0]) will be '10' and not 10.
- $array[10] still return $array[10] ?? $array['10']
- $array['10'] still return $array['10'] ?? $array[10]
so it still cast the value when accessing to an array key, but when using
array_keys/array_search/array_flip/... it won't be cast anymore.