On Wed, 18 Oct 2023 at 17:47, Levi Morrison <levi.morri...@datadoghq.com>
wrote:

>
> I don't see how `array_is_list` is relevant to `array_first` and
> `array_last`. PHP arrays are ordered:
>
>     $foo = [
>         "first" => 1,
>         "third" => 3,
>     ];
>
> It would be perfectly fine to use `array_first` or `array_last` with
> `$foo`. I think probably you would use `array_key_first` and
> `array_key_last` so you also get the key and not just the value, but I
> don't see any need to reduce `array_first` and `array_last` to only be
> logical or correct with arrays that uphold `array_is_list`.
>

I didn't mean that array_first/last should only work on lists; they should
work on any array as you mentioned. I was just correcting a statement about
lists.
Sorry if I wasn't clear.

- Benjamin

Reply via email to