Re: [RFC] Add is_list(mixed $value): bool to check for list-like arrays
| From: | Josh Bruce | Date: | Tue, 22 Dec 2020 21:39:48 +0000 |
| Subject: | Re: [RFC] Add is_list(mixed $value): bool to check for list-like arrays | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112605@lists.php.net to get a copy of this message | ||
>> tl;dr: Could add flags to is_array.
>
> Please, no.
>
> PHP needs fewer flags, not more.
>
> -Mike
lol - There’s something to be said for that.
Thinking of “simple" bridges that can be built toward a possible larger discussion around
naming and defining things and not adding more to the SL related to arrays until then while getting
the capability…cause that part of the SL is pretty large. :)
New term: list
Compared to known terms: indexed and associative
Compared to neither of those really describing the conceptual differences between:
- int-only keys ordered and starting at 0,
- int-only keys ordered and *not* starting at 0,
- int-only keys unordered,
- string-only keys, and
- int-or-string keys.
And the automatic casting of strings to ints.
Cheers,
Josh